update
This commit is contained in:
parent
2a542e9f5c
commit
8f62a41db3
1 changed files with 21 additions and 7 deletions
|
|
@ -3540,10 +3540,29 @@ export class CommandController extends Controller {
|
||||||
profile.lastUpdateUserId = req.user.sub;
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
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 curRevition = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }
|
||||||
|
})
|
||||||
|
|
||||||
|
if(curRevition){
|
||||||
|
const curPosMaster = await this.posMasterRepository.findOne({
|
||||||
|
where:{
|
||||||
|
current_holderId: profile.id,
|
||||||
|
orgRevisionId: curRevition.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (curPosMaster && clearProfile.LeaveType != "RETIRE_OUT_EMP") {
|
||||||
|
await CreatePosMasterHistoryOfficer(curPosMaster.id, req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//ลบตำแหน่ง
|
||||||
if (item.isLeave == true) {
|
if (item.isLeave == true) {
|
||||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||||
}
|
}
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
if (profile.keycloak != null) {
|
if (profile.keycloak != null) {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||||
|
|
@ -3601,7 +3620,7 @@ export class CommandController extends Controller {
|
||||||
positionNew.positionIsSelected = true;
|
positionNew.positionIsSelected = true;
|
||||||
await this.positionRepository.save(positionNew, { data: req });
|
await this.positionRepository.save(positionNew, { data: req });
|
||||||
}
|
}
|
||||||
// await CreatePosMasterHistoryOfficer(posMaster.id, req);
|
await CreatePosMasterHistoryOfficer(posMaster.id, req);
|
||||||
}
|
}
|
||||||
const newMapProfileSalary = {
|
const newMapProfileSalary = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
|
|
@ -3706,11 +3725,6 @@ export class CommandController extends Controller {
|
||||||
profile.isActive = true;
|
profile.isActive = true;
|
||||||
}
|
}
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
console.log("item>>>", item);
|
|
||||||
console.log("clearProfile.LeaveType >>>", clearProfile.LeaveType );
|
|
||||||
if (item.posmasterId && clearProfile.LeaveType != "RETIRE_OUT_EMP") {
|
|
||||||
await CreatePosMasterHistoryOfficer(item.posmasterId, req);
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue