This commit is contained in:
Adisak 2025-11-13 09:56:24 +07:00
parent 1680c7eba1
commit c4e1ee5546

View file

@ -4265,8 +4265,16 @@ export class CommandController extends Controller {
await Promise.all(
body.data.map(async (item) => {
const profile: any = await this.profileRepository.findOne({
where: { id: item.profileId },
relations: ["roleKeycloaks"],
where: {
id: item.profileId ,
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false,
},
}
},
relations: ["current_holders","roleKeycloaks"],
});
if (!profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
@ -4310,9 +4318,7 @@ export class CommandController extends Controller {
lastUpdatedAt: new Date(),
};
if (item.isLeave != undefined && item.isLeave == true) {
// if(orgRevisionRef){
// await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
// }
await CreatePosMasterHistoryOfficer(profile.current_holders.id, req, "DELETE");
await removeProfileInOrganize(profile.id, "OFFICER");
}
const clearProfile = await checkCommandType(String(item.commandId));