updated menu & del permission

This commit is contained in:
Warunee Tamkoo 2024-08-07 11:49:11 +07:00
parent 1768d4cbbb
commit 12885adf17
2 changed files with 34 additions and 7 deletions

View file

@ -101,6 +101,19 @@ export class AuthRoleController extends Controller {
posMaster.lastUpdateFullName = req.user.name;
posMaster.authRoleId = body.authRoleId;
await this.posMasterRepository.save(posMaster);
// เช็คว่าถ้ามีค่า current_holderId ให้ลบ key สิทธิ์ใน redis
if (posMaster.current_holderId) {
const redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
});
redisClient.del("role_" + posMaster.current_holderId, (err: Error, response: Response) => {
if (err) throw err;
console.log(response);
});
}
return new HttpSuccess();
}