"use strict";async function cachePermissions(){try{const e=await getPermissions();await redis.set("permissions",JSON.stringify(e),"EX",3600)}catch(e){console_1.logger.error("PERMISSION","Redis error",e)}}async function getPermissions(){return(await db_1.models.permission.findAll({include:[{model:db_1.models.role,as:"roles",through:{attributes:[]}}]})).map(e=>e.get({plain:!0}))}Object.defineProperty(exports,"__esModule",{value:!0});exports.cachePermissions=cachePermissions;exports.getPermissions=getPermissions;const db_1=require("@b/db"),redis_1=require("@b/utils/redis"),console_1=require("@b/utils/console"),redis=redis_1.RedisSingleton.getInstance();cachePermissions();