This commit is contained in:
Adisak 2025-11-12 18:20:02 +07:00
parent 62750576d3
commit 92f4ccb30a

View file

@ -4266,21 +4266,21 @@ export class CommandController extends Controller {
body.data.map(async (item) => {
const profile: any = await this.profileRepository.findOne({
where: { id: item.profileId },
relations: ["roleKeycloaks","current_holders"],
relations: ["roleKeycloaks"],
});
if (!profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
}
const orgRevision = await this.orgRevisionRepo.findOne({
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false,
},
});
// const orgRevision = await this.orgRevisionRepo.findOne({
// where: {
// orgRevisionIsCurrent: true,
// orgRevisionIsDraft: false,
// },
// });
const orgRevisionRef =
profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null;
// const orgRevisionRef =
// profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null;
//ลบตำแหน่งที่รักษาการแทน
const code = _command?.commandType?.code;
@ -4310,9 +4310,9 @@ export class CommandController extends Controller {
lastUpdatedAt: new Date(),
};
if (item.isLeave != undefined && item.isLeave == true) {
if(orgRevisionRef){
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
}
// if(orgRevisionRef){
// await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
// }
await removeProfileInOrganize(profile.id, "OFFICER");
}
const clearProfile = await checkCommandType(String(item.commandId));