Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop

This commit is contained in:
Kittapath 2024-07-31 10:57:38 +07:00
commit ede21bb2f8

View file

@ -35,9 +35,9 @@ export class PermissionController extends Controller {
const getAsync = promisify(redisClient.get).bind(redisClient); const getAsync = promisify(redisClient.get).bind(redisClient);
let reply = await getAsync("role_" + request.user.sub); let reply = await getAsync("role_" + request.user.sub);
if (reply != null) { // if (reply != null) {
reply = JSON.parse(reply); // reply = JSON.parse(reply);
} else { // } else {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
select: ["id"], select: ["id"],
where: { keycloak: request.user.sub }, where: { keycloak: request.user.sub },
@ -81,8 +81,8 @@ export class PermissionController extends Controller {
...getDetail, ...getDetail,
roles: roleAttrData, roles: roleAttrData,
}; };
redisClient.setex("role_" + request.user.sub, 86400, JSON.stringify(reply)); // redisClient.setex("role_" + request.user.sub, 86400, JSON.stringify(reply));
} // }
return new HttpSuccess(reply); return new HttpSuccess(reply);
} }