From 8fa3b89b14ae92f0e9c8f3babca4f2b1cbc7c11b Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Fri, 19 Sep 2025 23:43:59 +0700 Subject: [PATCH] create cornjob retire --- src/controllers/CommandController.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index a888eeff..8046056a 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -1559,6 +1559,12 @@ export class CommandController extends Controller { return new HttpSuccess(); } + @Get("cornjob/cronjobUpdateRetirementStatus") + async runCronjobUpdateRetirementStatus() { + await this.cronjobUpdateRetirementStatus(); + return new HttpSuccess(); + } + /** * API รายละเอียดรายการคำสั่ง tab4 คำสั่ง * @@ -3541,19 +3547,19 @@ export class CommandController extends Controller { profile.lastUpdateFullName = req.user.name; profile.lastUpdatedAt = new Date(); const clearProfile = await checkCommandType(String(item.commandId)); - + //ปั๊มประวัติก่อนลบตำแหน่ง const curRevision = await this.orgRevisionRepo.findOne({ - where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false } - }) + where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }, + }); - if(curRevision){ + if (curRevision) { const curPosMaster = await this.posMasterRepository.findOne({ - where:{ + where: { current_holderId: profile.id, - orgRevisionId: curRevision.id - } - }) + orgRevisionId: curRevision.id, + }, + }); if (curPosMaster && clearProfile.LeaveType != "RETIRE_OUT_EMP") { await CreatePosMasterHistoryOfficer(curPosMaster.id, req, "DELETE"); }