From 069e343ca66fe45b084b6099c13dbc3b0c4f1869 Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 17 Jan 2025 12:10:23 +0700 Subject: [PATCH] search perm --- src/controllers/ProfileEmployeeController.ts | 8 ++++---- src/controllers/UserController.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index b23523a4..50269e98 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -4091,7 +4091,7 @@ export class ProfileEmployeeController extends Controller { where: { keycloak: IsNull(), citizenId: Like(`%${body.keyword}%`), - employeeClass: "PREM", + employeeClass: "PERM", }, relations: ["posType", "posLevel", "current_holders"], skip, @@ -4104,7 +4104,7 @@ export class ProfileEmployeeController extends Controller { where: { keycloak: IsNull(), firstName: Like(`%${body.keyword}%`), - employeeClass: "PREM", + employeeClass: "PERM", }, relations: ["posType", "posLevel", "current_holders"], skip, @@ -4117,7 +4117,7 @@ export class ProfileEmployeeController extends Controller { where: { keycloak: IsNull(), lastName: Like(`%${body.keyword}%`), - employeeClass: "PREM", + employeeClass: "PERM", }, relations: ["posType", "posLevel", "current_holders"], skip, @@ -4129,7 +4129,7 @@ export class ProfileEmployeeController extends Controller { [findProfile, total] = await this.profileRepo.findAndCount({ where: { keycloak: IsNull(), - employeeClass: "PREM", + employeeClass: "PERM", }, relations: ["posType", "posLevel", "current_holders"], skip, diff --git a/src/controllers/UserController.ts b/src/controllers/UserController.ts index 80ce63d4..0a3dd02d 100644 --- a/src/controllers/UserController.ts +++ b/src/controllers/UserController.ts @@ -245,7 +245,7 @@ export class KeycloakController extends Controller { const profileEmp = await this.profileEmpRepo.findOne({ where: { keycloak: userId, - employeeClass: "PREM", + employeeClass: "PERM", }, relations: ["roleKeycloaks"], }); @@ -299,7 +299,7 @@ export class KeycloakController extends Controller { }); if (!profile) { const profileEmp = await this.profileEmpRepo.findOne({ - where: { keycloak: userId, employeeClass: "PREM" }, + where: { keycloak: userId, employeeClass: "PERM" }, relations: ["roleKeycloaks"], }); // if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); @@ -325,7 +325,7 @@ export class KeycloakController extends Controller { }); if (!profile) { const profileEmp = await this.profileEmpRepo.findOne({ - where: { keycloak: userId, employeeClass: "PREM" }, + where: { keycloak: userId, employeeClass: "PERM" }, relations: ["roleKeycloaks"], }); if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); @@ -564,7 +564,7 @@ export class KeycloakController extends Controller { .leftJoinAndSelect("profileEmployee.current_holders", "current_holders") .where("profileEmployee.keycloak IS NOT NULL AND profileEmployee.keycloak != ''") .andWhere(condition) - .andWhere({ employeeClass: "PREM" }) + .andWhere({ employeeClass: "PERM" }) .andWhere( new Brackets((qb) => { qb.orWhere( @@ -680,7 +680,7 @@ export class KeycloakController extends Controller { }); if (!profile) { const profileEmp = await this.profileEmpRepo.findOne({ - where: { keycloak: id, employeeClass: "PREM" }, + where: { keycloak: id, employeeClass: "PERM" }, relations: ["roleKeycloaks"], }); if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); @@ -700,7 +700,7 @@ export class KeycloakController extends Controller { }); if (!profile) { const profileEmp = await this.profileEmpRepo.findOne({ - where: { keycloak: userId, employeeClass: "PREM" }, + where: { keycloak: userId, employeeClass: "PERM" }, }); if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); profileEmp.isActive = status;