From c4e1ee55463de7ada93424507d492aff79acd4e4 Mon Sep 17 00:00:00 2001 From: Adisak Date: Thu, 13 Nov 2025 09:56:24 +0700 Subject: [PATCH] update --- src/controllers/CommandController.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 32a2c1c2..2bf311ac 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -4265,8 +4265,16 @@ export class CommandController extends Controller { await Promise.all( body.data.map(async (item) => { const profile: any = await this.profileRepository.findOne({ - where: { id: item.profileId }, - relations: ["roleKeycloaks"], + where: { + id: item.profileId , + current_holders: { + orgRevision: { + orgRevisionIsCurrent: true, + orgRevisionIsDraft: false, + }, + } + }, + relations: ["current_holders","roleKeycloaks"], }); if (!profile) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้"); @@ -4310,9 +4318,7 @@ export class CommandController extends Controller { lastUpdatedAt: new Date(), }; if (item.isLeave != undefined && item.isLeave == true) { - // if(orgRevisionRef){ - // await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE"); - // } + await CreatePosMasterHistoryOfficer(profile.current_holders.id, req, "DELETE"); await removeProfileInOrganize(profile.id, "OFFICER"); } const clearProfile = await checkCommandType(String(item.commandId));