fix: command C-PM-20 insert history
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m6s

This commit is contained in:
Adisak 2026-05-11 14:33:50 +07:00
parent 7a6cf119bd
commit 378c941a01

View file

@ -5450,6 +5450,21 @@ export class CommandController extends Controller {
_profile.leaveDate = item.commandDateAffect ?? _null;
_profile.leaveType = exceptClear.LeaveType ?? _null;
} else {
// บันทึกประวัติก่อนลบตำแหน่ง
const curRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
});
if (curRevision) {
const curPosMaster = await this.employeePosMasterRepository.findOne({
where: {
current_holderId: _profile.id,
orgRevisionId: curRevision.id,
},
});
if (curPosMaster) {
await CreatePosMasterHistoryEmployee(curPosMaster.id, req, "DELETE");
}
}
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
}
}