Compare commits
9 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
825263c11c | ||
| 664f5153da | |||
| 219a2908a3 | |||
|
|
b0cfbc7036 | ||
| 185aedc53f | |||
| 20c6c412b8 | |||
|
|
ad9a7dcbb6 | ||
|
|
774a58bc22 | ||
| 755ae992dd |
7 changed files with 194 additions and 191 deletions
|
|
@ -41,7 +41,6 @@ import {
|
||||||
removeProfileInOrganize,
|
removeProfileInOrganize,
|
||||||
setLogDataDiff,
|
setLogDataDiff,
|
||||||
checkReturnCommandType,
|
checkReturnCommandType,
|
||||||
checkExceptCommandType,
|
|
||||||
checkCommandType,
|
checkCommandType,
|
||||||
removePostMasterAct,
|
removePostMasterAct,
|
||||||
logPositionIsSelectedChange,
|
logPositionIsSelectedChange,
|
||||||
|
|
@ -4313,11 +4312,8 @@ export class CommandController extends Controller {
|
||||||
body.data.map(async (item) => {
|
body.data.map(async (item) => {
|
||||||
const profile = await this.profileRepository.findOne({
|
const profile = await this.profileRepository.findOne({
|
||||||
where: { id: item.profileId },
|
where: { id: item.profileId },
|
||||||
// relations: ["roleKeycloaks"],
|
|
||||||
relations: {
|
relations: {
|
||||||
roleKeycloaks: true,
|
roleKeycloaks: true
|
||||||
posType: true,
|
|
||||||
posLevel: true,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
|
|
@ -4613,6 +4609,8 @@ export class CommandController extends Controller {
|
||||||
await this.positionRepository.save(positionNew, { data: req });
|
await this.positionRepository.save(positionNew, { data: req });
|
||||||
}
|
}
|
||||||
await CreatePosMasterHistoryOfficer(posMaster.id, req);
|
await CreatePosMasterHistoryOfficer(posMaster.id, req);
|
||||||
|
profile.posMasterNo = getPosMasterNo(posMaster);
|
||||||
|
profile.org = getOrgFullName(posMaster);
|
||||||
}
|
}
|
||||||
const newMapProfileSalary = {
|
const newMapProfileSalary = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
|
|
@ -5629,21 +5627,11 @@ export class CommandController extends Controller {
|
||||||
_profile.lastUpdateFullName = req.user.name;
|
_profile.lastUpdateFullName = req.user.name;
|
||||||
_profile.lastUpdatedAt = new Date();
|
_profile.lastUpdatedAt = new Date();
|
||||||
if (item.isLeave == true) {
|
if (item.isLeave == true) {
|
||||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
|
||||||
if (exceptClear.status) {
|
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
|
||||||
} else {
|
|
||||||
if (orgRevisionRef) {
|
if (orgRevisionRef) {
|
||||||
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
|
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
|
||||||
}
|
}
|
||||||
await removeProfileInOrganize(_profile.id, "OFFICER");
|
await removeProfileInOrganize(_profile.id, "OFFICER");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
retireTypeName = clearProfile.retireTypeName ?? "";
|
retireTypeName = clearProfile.retireTypeName ?? "";
|
||||||
|
|
@ -5821,15 +5809,6 @@ export class CommandController extends Controller {
|
||||||
_profile.lastUpdateFullName = req.user.name;
|
_profile.lastUpdateFullName = req.user.name;
|
||||||
_profile.lastUpdatedAt = new Date();
|
_profile.lastUpdatedAt = new Date();
|
||||||
if (item.isLeave == true) {
|
if (item.isLeave == true) {
|
||||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
|
||||||
if (exceptClear.status) {
|
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
|
||||||
} else {
|
|
||||||
// บันทึกประวัติก่อนลบตำแหน่ง
|
// บันทึกประวัติก่อนลบตำแหน่ง
|
||||||
const curRevision = await this.orgRevisionRepo.findOne({
|
const curRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||||
|
|
@ -5847,7 +5826,6 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
retireTypeName = clearProfile.retireTypeName ?? "";
|
retireTypeName = clearProfile.retireTypeName ?? "";
|
||||||
|
|
@ -6166,15 +6144,6 @@ export class CommandController extends Controller {
|
||||||
_profile.lastUpdateFullName = req.user.name;
|
_profile.lastUpdateFullName = req.user.name;
|
||||||
_profile.lastUpdatedAt = new Date();
|
_profile.lastUpdatedAt = new Date();
|
||||||
if (item.isLeave == true) {
|
if (item.isLeave == true) {
|
||||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
|
||||||
if (exceptClear.status) {
|
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
|
||||||
} else {
|
|
||||||
// บันทึกประวัติก่อนลบตำแหน่ง
|
// บันทึกประวัติก่อนลบตำแหน่ง
|
||||||
const curRevision = await this.orgRevisionRepo.findOne({
|
const curRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||||
|
|
@ -6192,7 +6161,6 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -2372,7 +2372,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
@Security("internalAuth")
|
@Security("internalAuth")
|
||||||
async GetProfileForProcessCheckInAsync(@Path() keycloakId: string) {
|
async GetProfileForProcessCheckInAsync(@Path() keycloakId: string) {
|
||||||
try {
|
try {
|
||||||
console.log(`[check-keycloak] START - keycloakId=${keycloakId}`);
|
// console.log(`[check-keycloak] START - keycloakId=${keycloakId}`);
|
||||||
|
|
||||||
/* =========================
|
/* =========================
|
||||||
* 1. Load profile (Officer)
|
* 1. Load profile (Officer)
|
||||||
|
|
@ -2447,14 +2447,14 @@ export class OrganizationDotnetController extends Controller {
|
||||||
child4DnaId: currentHolder?.orgChild4?.ancestorDNA ?? null,
|
child4DnaId: currentHolder?.orgChild4?.ancestorDNA ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
`[check-keycloak] SUCCESS_EMPLOYEE - keycloakId=${keycloakId}, profileType=EMPLOYEE`,
|
// `[check-keycloak] SUCCESS_EMPLOYEE - keycloakId=${keycloakId}, profileType=EMPLOYEE`,
|
||||||
);
|
// );
|
||||||
|
|
||||||
return new HttpSuccess(mapProfile);
|
return new HttpSuccess(mapProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[check-keycloak] OFFICER_FOUND - keycloakId=${keycloakId}`);
|
// console.log(`[check-keycloak] OFFICER_FOUND - keycloakId=${keycloakId}`);
|
||||||
|
|
||||||
/* =========================================
|
/* =========================================
|
||||||
* 2. current holder (Officer)
|
* 2. current holder (Officer)
|
||||||
|
|
@ -2494,9 +2494,9 @@ export class OrganizationDotnetController extends Controller {
|
||||||
child4DnaId: currentHolder?.orgChild4?.ancestorDNA ?? null,
|
child4DnaId: currentHolder?.orgChild4?.ancestorDNA ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
`[check-keycloak] SUCCESS_OFFICER - keycloakId=${keycloakId}, profileType=OFFICER`,
|
// `[check-keycloak] SUCCESS_OFFICER - keycloakId=${keycloakId}, profileType=OFFICER`,
|
||||||
);
|
// );
|
||||||
|
|
||||||
return new HttpSuccess(mapProfile);
|
return new HttpSuccess(mapProfile);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
@ -9151,4 +9151,43 @@ export class OrganizationDotnetController extends Controller {
|
||||||
});
|
});
|
||||||
return new HttpSuccess(filteredPosMasters);
|
return new HttpSuccess(filteredPosMasters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ตรวจสอบสถานะผู้สมัครสอบ
|
||||||
|
* @summary API ตรวจสอบสถานะผู้สมัครสอบ
|
||||||
|
*/
|
||||||
|
@Post("check-isLeave")
|
||||||
|
@Security("internalAuth")
|
||||||
|
async findProfileIsLeave(
|
||||||
|
@Body()
|
||||||
|
req: { citizenIds: string[] }
|
||||||
|
) {
|
||||||
|
|
||||||
|
const profiles = await this.profileRepo.find({
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
citizenId: true,
|
||||||
|
isLeave: true,
|
||||||
|
isActive: true
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
citizenId: In(req.citizenIds)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (profiles.length === 0) {
|
||||||
|
return new HttpSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HttpSuccess(
|
||||||
|
profiles.map(p => ({
|
||||||
|
citizenId: p.citizenId,
|
||||||
|
profileId: p.id,
|
||||||
|
isLeave: p.isLeave ?? false,
|
||||||
|
isActive: p.isActive ?? false
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5779,6 +5779,22 @@ export class ProfileController extends Controller {
|
||||||
}
|
}
|
||||||
const record = await this.profileRepo.findOneBy({ id });
|
const record = await this.profileRepo.findOneBy({ id });
|
||||||
const before = structuredClone(record);
|
const before = structuredClone(record);
|
||||||
|
// เช็คว่ามี profileHistory ของ profile นี้หรือไม่
|
||||||
|
const historyCount = await this.profileHistoryRepo.count({
|
||||||
|
where: { profileId: id },
|
||||||
|
});
|
||||||
|
|
||||||
|
// ถ้าไม่มีเลย ให้บันทึกข้อมูลเริ่มต้น (ก่อน update) ลงไปก่อน
|
||||||
|
if (historyCount === 0) {
|
||||||
|
await this.profileHistoryRepo.save(
|
||||||
|
Object.assign(new ProfileHistory(), {
|
||||||
|
...before,
|
||||||
|
birthDateOld: before?.birthDate,
|
||||||
|
profileId: id,
|
||||||
|
id: undefined,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||||
|
|
||||||
|
|
@ -7935,40 +7951,38 @@ export class ProfileController extends Controller {
|
||||||
privacyUser: profile.privacyUser,
|
privacyUser: profile.privacyUser,
|
||||||
privacyMgt: profile.privacyMgt,
|
privacyMgt: profile.privacyMgt,
|
||||||
isDeputy: root?.isDeputy ?? false,
|
isDeputy: root?.isDeputy ?? false,
|
||||||
// root?.orgRootShortName && posMaster?.posMasterNo
|
|
||||||
// ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}`
|
|
||||||
// : "",
|
|
||||||
};
|
};
|
||||||
|
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
|
||||||
if (_profile.child4Id != null) {
|
if (_profile.child4Id != null) {
|
||||||
_profile.node = 4;
|
_profile.node = 4;
|
||||||
_profile.nodeId = _profile.child4Id;
|
_profile.nodeId = _profile.child4Id;
|
||||||
_profile.nodeDnaId = _profile.child4DnaId;
|
_profile.nodeDnaId = _profile.child4DnaId;
|
||||||
_profile.nodeShortName = _profile.child4ShortName;
|
_profile.nodeShortName = _profile.child4ShortName;
|
||||||
_profile.posNo = `${_profile.child4ShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child3Id != null) {
|
} else if (_profile.child3Id != null) {
|
||||||
_profile.node = 3;
|
_profile.node = 3;
|
||||||
_profile.nodeId = _profile.child3Id;
|
_profile.nodeId = _profile.child3Id;
|
||||||
_profile.nodeDnaId = _profile.child3DnaId;
|
_profile.nodeDnaId = _profile.child3DnaId;
|
||||||
_profile.nodeShortName = _profile.child3ShortName;
|
_profile.nodeShortName = _profile.child3ShortName;
|
||||||
_profile.posNo = `${_profile.child3ShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child2Id != null) {
|
} else if (_profile.child2Id != null) {
|
||||||
_profile.node = 2;
|
_profile.node = 2;
|
||||||
_profile.nodeId = _profile.child2Id;
|
_profile.nodeId = _profile.child2Id;
|
||||||
_profile.nodeDnaId = _profile.child2DnaId;
|
_profile.nodeDnaId = _profile.child2DnaId;
|
||||||
_profile.nodeShortName = _profile.child2ShortName;
|
_profile.nodeShortName = _profile.child2ShortName;
|
||||||
_profile.posNo = `${_profile.child2ShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child1Id != null) {
|
} else if (_profile.child1Id != null) {
|
||||||
_profile.node = 1;
|
_profile.node = 1;
|
||||||
_profile.nodeId = _profile.child1Id;
|
_profile.nodeId = _profile.child1Id;
|
||||||
_profile.nodeDnaId = _profile.child1DnaId;
|
_profile.nodeDnaId = _profile.child1DnaId;
|
||||||
_profile.nodeShortName = _profile.child1ShortName;
|
_profile.nodeShortName = _profile.child1ShortName;
|
||||||
_profile.posNo = `${_profile.child1ShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
|
||||||
} else if (_profile.rootId != null) {
|
} else if (_profile.rootId != null) {
|
||||||
_profile.node = 0;
|
_profile.node = 0;
|
||||||
_profile.nodeId = _profile.rootId;
|
_profile.nodeId = _profile.rootId;
|
||||||
_profile.nodeDnaId = _profile.rootDnaId;
|
_profile.nodeDnaId = _profile.rootDnaId;
|
||||||
_profile.nodeShortName = _profile.rootShortName;
|
_profile.nodeShortName = _profile.rootShortName;
|
||||||
_profile.posNo = `${_profile.rootShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
|
||||||
}
|
}
|
||||||
return new HttpSuccess(_profile);
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
@ -8108,41 +8122,39 @@ export class ProfileController extends Controller {
|
||||||
privacyUser: profile.privacyUser,
|
privacyUser: profile.privacyUser,
|
||||||
privacyMgt: profile.privacyMgt,
|
privacyMgt: profile.privacyMgt,
|
||||||
isDeputy: root?.isDeputy ?? false,
|
isDeputy: root?.isDeputy ?? false,
|
||||||
// root?.orgRootShortName && posMaster?.posMasterNo
|
|
||||||
// ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}`
|
|
||||||
// : "",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
|
||||||
if (_profile.child4Id != null) {
|
if (_profile.child4Id != null) {
|
||||||
_profile.node = 4;
|
_profile.node = 4;
|
||||||
_profile.nodeId = _profile.child4Id;
|
_profile.nodeId = _profile.child4Id;
|
||||||
_profile.nodeDnaId = _profile.child4DnaId;
|
_profile.nodeDnaId = _profile.child4DnaId;
|
||||||
_profile.nodeShortName = _profile.child4ShortName;
|
_profile.nodeShortName = _profile.child4ShortName;
|
||||||
_profile.posNo = `${_profile.child4ShortName} ${posMaster?.posMasterNo}`;
|
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child3Id != null) {
|
} else if (_profile.child3Id != null) {
|
||||||
_profile.node = 3;
|
_profile.node = 3;
|
||||||
_profile.nodeId = _profile.child3Id;
|
_profile.nodeId = _profile.child3Id;
|
||||||
_profile.nodeDnaId = _profile.child3DnaId;
|
_profile.nodeDnaId = _profile.child3DnaId;
|
||||||
_profile.nodeShortName = _profile.child3ShortName;
|
_profile.nodeShortName = _profile.child3ShortName;
|
||||||
_profile.posNo = `${_profile.child3ShortName} ${posMaster?.posMasterNo}`;
|
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child2Id != null) {
|
} else if (_profile.child2Id != null) {
|
||||||
_profile.node = 2;
|
_profile.node = 2;
|
||||||
_profile.nodeId = _profile.child2Id;
|
_profile.nodeId = _profile.child2Id;
|
||||||
_profile.nodeDnaId = _profile.child2DnaId;
|
_profile.nodeDnaId = _profile.child2DnaId;
|
||||||
_profile.nodeShortName = _profile.child2ShortName;
|
_profile.nodeShortName = _profile.child2ShortName;
|
||||||
_profile.posNo = `${_profile.child2ShortName} ${posMaster?.posMasterNo}`;
|
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child1Id != null) {
|
} else if (_profile.child1Id != null) {
|
||||||
_profile.node = 1;
|
_profile.node = 1;
|
||||||
_profile.nodeId = _profile.child1Id;
|
_profile.nodeId = _profile.child1Id;
|
||||||
_profile.nodeDnaId = _profile.child1DnaId;
|
_profile.nodeDnaId = _profile.child1DnaId;
|
||||||
_profile.nodeShortName = _profile.child1ShortName;
|
_profile.nodeShortName = _profile.child1ShortName;
|
||||||
_profile.posNo = `${_profile.child1ShortName} ${posMaster?.posMasterNo}`;
|
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
|
||||||
} else if (_profile.rootId != null) {
|
} else if (_profile.rootId != null) {
|
||||||
_profile.node = 0;
|
_profile.node = 0;
|
||||||
_profile.nodeId = _profile.rootId;
|
_profile.nodeId = _profile.rootId;
|
||||||
_profile.nodeDnaId = _profile.rootDnaId;
|
_profile.nodeDnaId = _profile.rootDnaId;
|
||||||
_profile.nodeShortName = _profile.rootShortName;
|
_profile.nodeShortName = _profile.rootShortName;
|
||||||
_profile.posNo = `${_profile.rootShortName} ${posMaster?.posMasterNo}`;
|
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
|
||||||
}
|
}
|
||||||
return new HttpSuccess(_profile);
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
@ -9313,26 +9325,32 @@ export class ProfileController extends Controller {
|
||||||
: "-",
|
: "-",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
|
||||||
if (_profile.child4Id != null) {
|
if (_profile.child4Id != null) {
|
||||||
_profile.node = 4;
|
_profile.node = 4;
|
||||||
_profile.nodeId = _profile.child4Id;
|
_profile.nodeId = _profile.child4Id;
|
||||||
_profile.nodeShortName = _profile.child4ShortName;
|
_profile.nodeShortName = _profile.child4ShortName;
|
||||||
|
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child3Id != null) {
|
} else if (_profile.child3Id != null) {
|
||||||
_profile.node = 3;
|
_profile.node = 3;
|
||||||
_profile.nodeId = _profile.child3Id;
|
_profile.nodeId = _profile.child3Id;
|
||||||
_profile.nodeShortName = _profile.child3ShortName;
|
_profile.nodeShortName = _profile.child3ShortName;
|
||||||
|
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child2Id != null) {
|
} else if (_profile.child2Id != null) {
|
||||||
_profile.node = 2;
|
_profile.node = 2;
|
||||||
_profile.nodeId = _profile.child2Id;
|
_profile.nodeId = _profile.child2Id;
|
||||||
_profile.nodeShortName = _profile.child2ShortName;
|
_profile.nodeShortName = _profile.child2ShortName;
|
||||||
|
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child1Id != null) {
|
} else if (_profile.child1Id != null) {
|
||||||
_profile.node = 1;
|
_profile.node = 1;
|
||||||
_profile.nodeId = _profile.child1Id;
|
_profile.nodeId = _profile.child1Id;
|
||||||
_profile.nodeShortName = _profile.child1ShortName;
|
_profile.nodeShortName = _profile.child1ShortName;
|
||||||
|
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
|
||||||
} else if (_profile.rootId != null) {
|
} else if (_profile.rootId != null) {
|
||||||
_profile.node = 0;
|
_profile.node = 0;
|
||||||
_profile.nodeId = _profile.rootId;
|
_profile.nodeId = _profile.rootId;
|
||||||
_profile.nodeShortName = _profile.rootShortName;
|
_profile.nodeShortName = _profile.rootShortName;
|
||||||
|
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
|
||||||
}
|
}
|
||||||
return new HttpSuccess(_profile);
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
@ -9513,38 +9531,28 @@ export class ProfileController extends Controller {
|
||||||
const mapDataProfile = await Promise.all(
|
const mapDataProfile = await Promise.all(
|
||||||
findProfile.map(async (item: Profile) => {
|
findProfile.map(async (item: Profile) => {
|
||||||
const fullName = `${item.prefix}${item.firstName} ${item.lastName}`;
|
const fullName = `${item.prefix}${item.firstName} ${item.lastName}`;
|
||||||
const shortName =
|
const holder = item.current_holders?.find((x) => x.orgRevisionId == findRevision.id);
|
||||||
item.current_holders.length == 0
|
const _numPart = holder ? [holder.posMasterNoPrefix, holder.posMasterNo, holder.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
|
||||||
|
const shortName = !holder
|
||||||
? null
|
? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
: holder.orgChild4 != null
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 !=
|
? `${holder.orgChild4.orgChild4ShortName} ${_numPart}`
|
||||||
null
|
: holder.orgChild3 != null
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
? `${holder.orgChild3.orgChild3ShortName} ${_numPart}`
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
: holder.orgChild2 != null
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3 !=
|
? `${holder.orgChild2.orgChild2ShortName} ${_numPart}`
|
||||||
null
|
: holder.orgChild1 != null
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
? `${holder.orgChild1.orgChild1ShortName} ${_numPart}`
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
: holder.orgRoot != null
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
? `${holder.orgRoot.orgRootShortName} ${_numPart}`
|
||||||
?.orgChild2 != null
|
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
|
||||||
?.orgChild1 != null
|
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) !=
|
|
||||||
null &&
|
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
|
||||||
?.orgRoot != null
|
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const root =
|
const root =
|
||||||
item.current_holders.length == 0 ||
|
item.current_holders.length == 0 ||
|
||||||
(item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
(holder != null &&
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
holder?.orgRoot == null)
|
||||||
? null
|
? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: holder?.orgRoot;
|
||||||
|
|
||||||
const rootHolder = item.current_holders?.find(
|
const rootHolder = item.current_holders?.find(
|
||||||
(x) => x.orgRevisionId == findRevision.id,
|
(x) => x.orgRevisionId == findRevision.id,
|
||||||
|
|
|
||||||
|
|
@ -2385,6 +2385,24 @@ export class ProfileEmployeeController extends Controller {
|
||||||
Extension.CheckCitizen(body.citizenId);
|
Extension.CheckCitizen(body.citizenId);
|
||||||
}
|
}
|
||||||
const record = await this.profileRepo.findOneBy({ id });
|
const record = await this.profileRepo.findOneBy({ id });
|
||||||
|
const before = structuredClone(record);
|
||||||
|
// เช็คว่ามี profileHistory ของ profile นี้หรือไม่
|
||||||
|
const historyCount = await this.profileHistoryRepo.count({
|
||||||
|
where: { profileEmployeeId: id },
|
||||||
|
});
|
||||||
|
|
||||||
|
// ถ้าไม่มีเลย ให้บันทึกข้อมูลเริ่มต้น (ก่อน update) ลงไปก่อน
|
||||||
|
if (historyCount === 0) {
|
||||||
|
await this.profileHistoryRepo.save(
|
||||||
|
Object.assign(new ProfileEmployeeHistory(), {
|
||||||
|
...before,
|
||||||
|
birthDateOld: before?.birthDate,
|
||||||
|
profileEmployeeId: id,
|
||||||
|
id: undefined,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||||
|
|
||||||
if (body.employeeClass == null || body.employeeClass == undefined || body.employeeClass == "") {
|
if (body.employeeClass == null || body.employeeClass == undefined || body.employeeClass == "") {
|
||||||
|
|
@ -4003,40 +4021,38 @@ export class ProfileEmployeeController extends Controller {
|
||||||
salary: profile ? profile.amount : null,
|
salary: profile ? profile.amount : null,
|
||||||
amountSpecial: profile ? profile.amountSpecial : null,
|
amountSpecial: profile ? profile.amountSpecial : null,
|
||||||
posNo: null,
|
posNo: null,
|
||||||
// root?.orgRootShortName && posMaster?.posMasterNo
|
|
||||||
// ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}`
|
|
||||||
// : "",
|
|
||||||
};
|
};
|
||||||
|
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
|
||||||
if (_profile.child4Id != null) {
|
if (_profile.child4Id != null) {
|
||||||
_profile.node = 4;
|
_profile.node = 4;
|
||||||
_profile.nodeId = _profile.child4Id;
|
_profile.nodeId = _profile.child4Id;
|
||||||
_profile.nodeDnaId = _profile.child4DnaId;
|
_profile.nodeDnaId = _profile.child4DnaId;
|
||||||
_profile.nodeShortName = _profile.child4ShortName;
|
_profile.nodeShortName = _profile.child4ShortName;
|
||||||
_profile.posNo = `${_profile.child4ShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child3Id != null) {
|
} else if (_profile.child3Id != null) {
|
||||||
_profile.node = 3;
|
_profile.node = 3;
|
||||||
_profile.nodeId = _profile.child3Id;
|
_profile.nodeId = _profile.child3Id;
|
||||||
_profile.nodeDnaId = _profile.child3DnaId;
|
_profile.nodeDnaId = _profile.child3DnaId;
|
||||||
_profile.nodeShortName = _profile.child3ShortName;
|
_profile.nodeShortName = _profile.child3ShortName;
|
||||||
_profile.posNo = `${_profile.child3ShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child2Id != null) {
|
} else if (_profile.child2Id != null) {
|
||||||
_profile.node = 2;
|
_profile.node = 2;
|
||||||
_profile.nodeId = _profile.child2Id;
|
_profile.nodeId = _profile.child2Id;
|
||||||
_profile.nodeDnaId = _profile.child2DnaId;
|
_profile.nodeDnaId = _profile.child2DnaId;
|
||||||
_profile.nodeShortName = _profile.child2ShortName;
|
_profile.nodeShortName = _profile.child2ShortName;
|
||||||
_profile.posNo = `${_profile.child2ShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child1Id != null) {
|
} else if (_profile.child1Id != null) {
|
||||||
_profile.node = 1;
|
_profile.node = 1;
|
||||||
_profile.nodeId = _profile.child1Id;
|
_profile.nodeId = _profile.child1Id;
|
||||||
_profile.nodeDnaId = _profile.child1DnaId;
|
_profile.nodeDnaId = _profile.child1DnaId;
|
||||||
_profile.nodeShortName = _profile.child1ShortName;
|
_profile.nodeShortName = _profile.child1ShortName;
|
||||||
_profile.posNo = `${_profile.child1ShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
|
||||||
} else if (_profile.rootId != null) {
|
} else if (_profile.rootId != null) {
|
||||||
_profile.node = 0;
|
_profile.node = 0;
|
||||||
_profile.nodeId = _profile.rootId;
|
_profile.nodeId = _profile.rootId;
|
||||||
_profile.nodeDnaId = _profile.rootDnaId;
|
_profile.nodeDnaId = _profile.rootDnaId;
|
||||||
_profile.nodeShortName = _profile.rootShortName;
|
_profile.nodeShortName = _profile.rootShortName;
|
||||||
_profile.posNo = `${_profile.rootShortName} ${_profile.posMasterNo}`;
|
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
|
||||||
}
|
}
|
||||||
return new HttpSuccess(_profile);
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
@ -6444,33 +6460,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
null
|
null
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4;
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4;
|
||||||
const shortName =
|
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
|
||||||
profile.current_holders.length == 0
|
|
||||||
? null
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null &&
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
|
||||||
?.orgChild4 != null
|
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4.orgChild4ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null &&
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
|
||||||
?.orgChild3 != null
|
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3.orgChild3ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
|
|
||||||
null &&
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
|
||||||
?.orgChild2 != null
|
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2.orgChild2ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
|
|
||||||
null &&
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
|
||||||
?.orgChild1 != null
|
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1.orgChild1ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
|
|
||||||
null &&
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
|
||||||
?.orgRoot != null
|
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot.orgRootShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
|
|
||||||
: null;
|
|
||||||
const _profile: any = {
|
const _profile: any = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
prefix: profile.prefix,
|
prefix: profile.prefix,
|
||||||
|
|
@ -6512,7 +6502,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
|
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
|
||||||
node: null,
|
node: null,
|
||||||
nodeId: null,
|
nodeId: null,
|
||||||
posNo: shortName,
|
posNo: null,
|
||||||
salary: profile.amount,
|
salary: profile.amount,
|
||||||
education:
|
education:
|
||||||
profile && profile.profileEducations.length > 0
|
profile && profile.profileEducations.length > 0
|
||||||
|
|
@ -6527,22 +6517,27 @@ export class ProfileEmployeeController extends Controller {
|
||||||
_profile.node = 4;
|
_profile.node = 4;
|
||||||
_profile.nodeId = _profile.child4Id;
|
_profile.nodeId = _profile.child4Id;
|
||||||
_profile.nodeShortName = _profile.child4ShortName;
|
_profile.nodeShortName = _profile.child4ShortName;
|
||||||
|
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child3Id != null) {
|
} else if (_profile.child3Id != null) {
|
||||||
_profile.node = 3;
|
_profile.node = 3;
|
||||||
_profile.nodeId = _profile.child3Id;
|
_profile.nodeId = _profile.child3Id;
|
||||||
_profile.nodeShortName = _profile.child3ShortName;
|
_profile.nodeShortName = _profile.child3ShortName;
|
||||||
|
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child2Id != null) {
|
} else if (_profile.child2Id != null) {
|
||||||
_profile.node = 2;
|
_profile.node = 2;
|
||||||
_profile.nodeId = _profile.child2Id;
|
_profile.nodeId = _profile.child2Id;
|
||||||
_profile.nodeShortName = _profile.child2ShortName;
|
_profile.nodeShortName = _profile.child2ShortName;
|
||||||
|
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
|
||||||
} else if (_profile.child1Id != null) {
|
} else if (_profile.child1Id != null) {
|
||||||
_profile.node = 1;
|
_profile.node = 1;
|
||||||
_profile.nodeId = _profile.child1Id;
|
_profile.nodeId = _profile.child1Id;
|
||||||
_profile.nodeShortName = _profile.child1ShortName;
|
_profile.nodeShortName = _profile.child1ShortName;
|
||||||
|
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
|
||||||
} else if (_profile.rootId != null) {
|
} else if (_profile.rootId != null) {
|
||||||
_profile.node = 0;
|
_profile.node = 0;
|
||||||
_profile.nodeId = _profile.rootId;
|
_profile.nodeId = _profile.rootId;
|
||||||
_profile.nodeShortName = _profile.rootShortName;
|
_profile.nodeShortName = _profile.rootShortName;
|
||||||
|
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
|
||||||
}
|
}
|
||||||
return new HttpSuccess(_profile);
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1001,6 +1001,24 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = await this.profileRepo.findOneBy({ id });
|
const record = await this.profileRepo.findOneBy({ id });
|
||||||
|
const before = structuredClone(record);
|
||||||
|
// เช็คว่ามี profileHistory ของ profile นี้หรือไม่
|
||||||
|
const historyCount = await this.profileHistoryRepo.count({
|
||||||
|
where: { profileEmployeeId: id },
|
||||||
|
});
|
||||||
|
|
||||||
|
// ถ้าไม่มีเลย ให้บันทึกข้อมูลเริ่มต้น (ก่อน update) ลงไปก่อน
|
||||||
|
if (historyCount === 0) {
|
||||||
|
await this.profileHistoryRepo.save(
|
||||||
|
Object.assign(new ProfileEmployeeHistory(), {
|
||||||
|
...before,
|
||||||
|
birthDateOld: before?.birthDate,
|
||||||
|
profileEmployeeId: id,
|
||||||
|
id: undefined,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||||
|
|
||||||
if (body.employeeClass == null || body.employeeClass == undefined || body.employeeClass == "") {
|
if (body.employeeClass == null || body.employeeClass == undefined || body.employeeClass == "") {
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ export async function removeProfileInOrganize(profileId: string, type: string) {
|
||||||
await AppDataSource.getRepository(EmployeePosMaster)
|
await AppDataSource.getRepository(EmployeePosMaster)
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.update(EmployeePosMaster)
|
.update(EmployeePosMaster)
|
||||||
.set({ current_holderId: null })
|
.set({ current_holderId: null, isSit: false })
|
||||||
.where("id = :id", { id: findProfileInEmpPosMaster?.id })
|
.where("id = :id", { id: findProfileInEmpPosMaster?.id })
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
|
|
@ -395,43 +395,6 @@ export async function checkReturnCommandType(commandId: string) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkExceptCommandType(commandId: string) {
|
|
||||||
const commandRepository = AppDataSource.getRepository(Command);
|
|
||||||
const commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
|
||||||
const _type = await commandRepository.findOne({
|
|
||||||
where: {
|
|
||||||
id: commandId,
|
|
||||||
},
|
|
||||||
relations: ["commandType"],
|
|
||||||
});
|
|
||||||
if (!["C-PM-25", "C-PM-26"].includes(String(_type?.commandType.code))) {
|
|
||||||
return { status: false, LeaveType: null, leaveRemark: null };
|
|
||||||
}
|
|
||||||
const _commandRecive = await commandReciveRepository.findOne({
|
|
||||||
where: { commandId: commandId },
|
|
||||||
});
|
|
||||||
|
|
||||||
let _leaveType: string = "";
|
|
||||||
switch (String(_type?.commandType.code)) {
|
|
||||||
case "C-PM-25": {
|
|
||||||
_leaveType = "DISCIPLINE_SUSPEND"; //คำสั่งพักจากราชการ
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "C-PM-26": {
|
|
||||||
_leaveType = "DISCIPLINE_TEMP_SUSPEND"; //คำสั่งให้ออกจากราชการไว้ก่อน
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
_leaveType = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
status: true,
|
|
||||||
LeaveType: _leaveType,
|
|
||||||
leaveRemark: _commandRecive ? _commandRecive.remarkVertical : null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function checkCommandType(commandId: string) {
|
export async function checkCommandType(commandId: string) {
|
||||||
const commandRepository = AppDataSource.getRepository(Command);
|
const commandRepository = AppDataSource.getRepository(Command);
|
||||||
const commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
const commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
||||||
|
|
@ -451,6 +414,8 @@ export async function checkCommandType(commandId: string) {
|
||||||
"C-PM-23",
|
"C-PM-23",
|
||||||
"C-PM-19",
|
"C-PM-19",
|
||||||
"C-PM-20",
|
"C-PM-20",
|
||||||
|
"C-PM-25",
|
||||||
|
"C-PM-26",
|
||||||
"C-PM-43",
|
"C-PM-43",
|
||||||
].includes(String(_type?.commandType.code))
|
].includes(String(_type?.commandType.code))
|
||||||
) {
|
) {
|
||||||
|
|
@ -500,6 +465,16 @@ export async function checkCommandType(commandId: string) {
|
||||||
_retireTypeName = "ลาออกจากราชการ";
|
_retireTypeName = "ลาออกจากราชการ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "C-PM-25": {
|
||||||
|
_leaveType = "DISCIPLINE_SUSPEND";
|
||||||
|
_retireTypeName = "พักจากราชการ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "C-PM-26": {
|
||||||
|
_leaveType = "DISCIPLINE_TEMP_SUSPEND";
|
||||||
|
_retireTypeName = "ให้ออกจากราชการไว้ก่อน";
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "C-PM-43": {
|
case "C-PM-43": {
|
||||||
_leaveType = "RETIRE_OUT_EMP";
|
_leaveType = "RETIRE_OUT_EMP";
|
||||||
_retireTypeName = "ให้ออกจากราชการ";
|
_retireTypeName = "ให้ออกจากราชการ";
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export async function handleInternalAuth(request: express.Request) {
|
||||||
throw new HttpError(HttpStatus.UNAUTHORIZED, "Invalid API Key");
|
throw new HttpError(HttpStatus.UNAUTHORIZED, "Invalid API Key");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[InternalAuth] Authentication successful`);
|
// console.log(`[InternalAuth] Authentication successful`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sub: "internal_service",
|
sub: "internal_service",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue