closed#2190 post to exprofile if production only
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m24s

This commit is contained in:
Warunee Tamkoo 2026-02-20 15:17:09 +07:00
parent 637e995915
commit 4e396b454d
5 changed files with 831 additions and 839 deletions

View file

@ -317,7 +317,15 @@ export class ProfileEmployeeController extends Controller {
];
const educations = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
select: [
"startDate",
"endDate",
"educationLevel",
"degree",
"field",
"institute",
"isDeleted",
],
where: { profileEmployeeId: id, isDeleted: false },
order: { level: "ASC" },
});
@ -651,7 +659,15 @@ export class ProfileEmployeeController extends Controller {
];
const education_raw = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
select: [
"startDate",
"endDate",
"educationLevel",
"degree",
"field",
"institute",
"isDeleted",
],
where: { profileEmployeeId: id, isDeleted: false },
// order: { lastUpdatedAt: "DESC" },
order: { level: "ASC" },
@ -1048,7 +1064,14 @@ export class ProfileEmployeeController extends Controller {
let _child4 = child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
select: ["certificateType", "issuer", "certificateNo", "issueDate", "expireDate", "isDeleted"],
select: [
"certificateType",
"issuer",
"certificateNo",
"issueDate",
"expireDate",
"isDeleted",
],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
@ -1065,12 +1088,14 @@ export class ProfileEmployeeController extends Controller {
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate))
: "",
issueToExpireDate: item.issueDate
? item.expireDate
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.issueDate)} - ${Extension.ToThaiFullDate2(item.expireDate)}`)
? item.expireDate
? Extension.ToThaiNumber(
`${Extension.ToThaiFullDate2(item.issueDate)} - ${Extension.ToThaiFullDate2(item.expireDate)}`,
)
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate))
: item.expireDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate))
: ""
: "",
}))
: [
{
@ -1242,7 +1267,7 @@ export class ProfileEmployeeController extends Controller {
"page",
"refCommandDate",
"note",
"isDeleted"
"isDeleted",
],
relations: {
insignia: {
@ -1321,9 +1346,7 @@ export class ProfileEmployeeController extends Controller {
const totalLeaveDaysKey = `totalLeaveDaysLv${lvIndex}`;
const leaveTypeNameKey = `leaveTypeNameLv${lvIndex}`;
const leaveDate = item.maxDateLeaveStart
? new Date(item.maxDateLeaveStart)
: null;
const leaveDate = item.maxDateLeaveStart ? new Date(item.maxDateLeaveStart) : null;
const year = leaveDate
? Extension.ToThaiNumber(Extension.ToThaiShortYear(leaveDate))
: "";
@ -1521,7 +1544,9 @@ export class ProfileEmployeeController extends Controller {
? actposition_raw.map((item) => ({
date:
item.dateStart && item.dateEnd
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
? Extension.ToThaiNumber(
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
)
: item.dateStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
: item.dateEnd
@ -1546,7 +1571,9 @@ export class ProfileEmployeeController extends Controller {
? assistance_raw.map((item) => ({
date:
item.dateStart && item.dateEnd
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
? Extension.ToThaiNumber(
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
)
: item.dateStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
: item.dateEnd
@ -1576,7 +1603,9 @@ export class ProfileEmployeeController extends Controller {
? duty_raw.map((item) => ({
date:
item.dateStart && item.dateEnd
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
? Extension.ToThaiNumber(
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
)
: item.dateStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
: item.dateEnd
@ -1836,7 +1865,7 @@ export class ProfileEmployeeController extends Controller {
? Extension.ToThaiNumber(profiles.registrationZipCode)
: "",
fullRegistrationAddress: fullRegistrationAddress,
updateAt: profiles.lastUpdatedAt
updateAt: profiles.lastUpdatedAt
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.lastUpdatedAt))
: "",
telephone: profiles.phone != null ? Extension.ToThaiNumber(profiles.phone) : "",
@ -2888,8 +2917,8 @@ export class ProfileEmployeeController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
`current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,
@ -3768,8 +3797,8 @@ export class ProfileEmployeeController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
`current_holders.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)
@ -4327,8 +4356,8 @@ export class ProfileEmployeeController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
`current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,
@ -5396,28 +5425,17 @@ export class ProfileEmployeeController extends Controller {
organizeName = names.join(" ");
}
await PostRetireToExprofile(
// profile.citizenId ?? "",
// profile.prefix ?? "",
// profile.firstName ?? "",
// profile.lastName ?? "",
// requestBody.dateLeave?.getFullYear().toString() ?? "",
// profile.position,
// profile.posType?.posTypeName ?? "",
// `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`,
// requestBody.dateLeave ?? new Date(),
// organizeName,
// "ถึงแก่กรรม",
"310190004095X",
"จ.ส.อ.",
"dev",
"hrms",
"2026",
"เจ้าหน้าที่จัดเก็บรายได้",
"อื่นๆ",
"C 3",
new Date(2026, 0, 1),
"สำนักงานเขตบางกอกใหญ่",
"เกษียณ"
profile.citizenId ?? "",
profile.prefix ?? "",
profile.firstName ?? "",
profile.lastName ?? "",
requestBody.dateLeave?.getFullYear().toString() ?? "",
profile.position,
profile.posType?.posTypeName ?? "",
`${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`,
requestBody.dateLeave ?? new Date(),
organizeName,
"ถึงแก่กรรม",
);
return new HttpSuccess();
}