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

@ -322,7 +322,15 @@ export class ProfileController 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: { profileId: id, isDeleted: false },
order: { level: "ASC" },
});
@ -655,7 +663,15 @@ export class ProfileController 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: { profileId: id, isDeleted: false },
// order: { lastUpdatedAt: "DESC" },
order: { level: "ASC" },
@ -1052,7 +1068,14 @@ export class ProfileController 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: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
@ -1069,12 +1092,14 @@ export class ProfileController 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))
: ""
: "",
}))
: [
{
@ -1246,7 +1271,7 @@ export class ProfileController extends Controller {
"page",
"refCommandDate",
"note",
"isDeleted"
"isDeleted",
],
relations: {
insignia: {
@ -1325,9 +1350,7 @@ export class ProfileController 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))
: "";
@ -1525,7 +1548,9 @@ export class ProfileController 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
@ -1550,7 +1575,9 @@ export class ProfileController 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
@ -1580,7 +1607,9 @@ export class ProfileController 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
@ -1858,7 +1887,7 @@ export class ProfileController 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) : "",
@ -2267,8 +2296,8 @@ export class ProfileController 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,
@ -6244,8 +6273,8 @@ export class ProfileController 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 },
)
@ -6632,8 +6661,8 @@ export class ProfileController 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 },
)
@ -7718,7 +7747,7 @@ export class ProfileController extends Controller {
child2Id: null,
child3Id: null,
child4Id: null,
rootDnaId: null
rootDnaId: null,
});
}
return new HttpSuccess({
@ -7728,7 +7757,7 @@ export class ProfileController extends Controller {
child2Id: posMasters?.orgChild2Id || null,
child3Id: posMasters?.orgChild3Id || null,
child4Id: posMasters?.orgChild4Id || null,
rootDnaId: posMasters?.orgRoot?.ancestorDNA || null
rootDnaId: posMasters?.orgRoot?.ancestorDNA || null,
});
}
@ -8987,8 +9016,8 @@ export class ProfileController 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 },
)
@ -9511,8 +9540,8 @@ export class ProfileController 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,
@ -10922,28 +10951,17 @@ export class ProfileController 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.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.posLevel?.posLevelName ?? "",
requestBody.dateLeave ?? new Date(),
organizeName,
"ถึงแก่กรรม",
);
return new HttpSuccess();
}