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
* *
@ -3541,19 +3547,19 @@ export class CommandController extends Controller {
profile.lastUpdateFullName = req.user.name; profile.lastUpdateFullName = req.user.name;
profile.lastUpdatedAt = new Date(); profile.lastUpdatedAt = new Date();
const clearProfile = await checkCommandType(String(item.commandId)); const clearProfile = await checkCommandType(String(item.commandId));
//ปั๊มประวัติก่อนลบตำแหน่ง //ปั๊มประวัติก่อนลบตำแหน่ง
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");
} }