create cornjob retire

This commit is contained in:
mamoss 2025-09-19 23:43:59 +07:00
parent f4256117ef
commit 8fa3b89b14

View file

@ -1559,6 +1559,12 @@ export class CommandController extends Controller {
return new HttpSuccess(); return new HttpSuccess();
} }
@Get("cornjob/cronjobUpdateRetirementStatus")
async runCronjobUpdateRetirementStatus() {
await this.cronjobUpdateRetirementStatus();
return new HttpSuccess();
}
/** /**
* API tab4 * API tab4
* *
@ -3544,16 +3550,16 @@ export class CommandController extends Controller {
//ปั๊มประวัติก่อนลบตำแหน่ง //ปั๊มประวัติก่อนลบตำแหน่ง
const curRevision = await this.orgRevisionRepo.findOne({ 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({ const curPosMaster = await this.posMasterRepository.findOne({
where:{ where: {
current_holderId: profile.id, current_holderId: profile.id,
orgRevisionId: curRevision.id orgRevisionId: curRevision.id,
} },
}) });
if (curPosMaster && clearProfile.LeaveType != "RETIRE_OUT_EMP") { if (curPosMaster && clearProfile.LeaveType != "RETIRE_OUT_EMP") {
await CreatePosMasterHistoryOfficer(curPosMaster.id, req, "DELETE"); await CreatePosMasterHistoryOfficer(curPosMaster.id, req, "DELETE");
} }