From bceeab8ba91a998daa2f2f16291cfcb082bf23f8 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Tue, 6 May 2025 11:55:33 +0700 Subject: [PATCH 1/3] fix --- src/controllers/ProfileLeaveController.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/controllers/ProfileLeaveController.ts b/src/controllers/ProfileLeaveController.ts index 794c5785..f5601c02 100644 --- a/src/controllers/ProfileLeaveController.ts +++ b/src/controllers/ProfileLeaveController.ts @@ -133,7 +133,10 @@ export class ProfileLeaveController extends Controller { await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId); const record = await this.leaveRepo.find({ relations: { leaveType: true }, - where: { profileId: profileId, status: Not("cancel") }, + where: { + profileId: profileId, + // status: Not("cancel") + }, order: { createdAt: "ASC" }, }); return new HttpSuccess(record); From 16f3d3da4f7bf41725fe8847aa5a1e1454bdcae7 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 6 May 2025 12:13:56 +0700 Subject: [PATCH 2/3] return dna & fix/add fields --- .../OrganizationDotnetController.ts | 82 +++++++++++-------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index 6e5e638b..a9b68243 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -3056,18 +3056,23 @@ export class OrganizationDotnetController extends Controller { posExecutiveId: position == null || position.posExecutive == null ? null : position.posExecutive.id, rootId: root == null ? null : root.id, + rootDnaId: root == null ? null : root.ancestorDNA, root: root == null ? null : root.orgRootName, rootShortName: root == null ? null : root.orgRootShortName, child1Id: child1 == null ? null : child1.id, + child1DnaId: child1 == null ? null : child1.ancestorDNA, child1: child1 == null ? null : child1.orgChild1Name, child1ShortName: child1 == null ? null : child1.orgChild1ShortName, child2Id: child2 == null ? null : child2.id, + child2DnaId: child2 == null ? null : child2.ancestorDNA, child2: child2 == null ? null : child2.orgChild2Name, child2ShortName: child2 == null ? null : child2.orgChild2ShortName, child3Id: child3 == null ? null : child3.id, + child3DnaId: child3 == null ? null : child3.ancestorDNA, child3: child3 == null ? null : child3.orgChild3Name, child3ShortName: child3 == null ? null : child3.orgChild3ShortName, child4Id: child4 == null ? null : child4.id, + child4DnaId: child4 == null ? null : child4.ancestorDNA, child4: child4 == null ? null : child4.orgChild4Name, child4ShortName: child4 == null ? null : child4.orgChild4ShortName, node: null, @@ -4216,17 +4221,19 @@ export class OrganizationDotnetController extends Controller { const _position = position.length > 0 ? position[0] : []; const mapEmpProfile = { - birthDate: profile.birthDate ?? null, - retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : null, - govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "", - age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "", - dateAppoint: profile.dateAppoint, - amount: profile.amount, - telephoneNumber: profile.telephoneNumber ?? null, - positionName: profile.position, + birthDate: profile.birthDate ?? "-", + retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-", + govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "-", + age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-", + dateAppoint: profile.dateAppoint ?? "-", + dateCurrent: new Date(), + amount: profile.amount ?? "-", + telephoneNumber: profile.telephoneNumber ?? "-", + positionName: profile.position ?? "-", posLevel: profile.posType && profile.posLevel - ? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}` : null, - posType: profile.posType?.posTypeName ?? null, + ? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}` + : "-", + posType: profile.posType?.posTypeName ?? "-", currentAddress: profile && profile.currentAddress ? profile.currentAddress + (profile.currentSubDistrict && profile.currentSubDistrict.name @@ -4236,8 +4243,8 @@ export class OrganizationDotnetController extends Controller { (profile.currentProvince && profile.currentProvince.name ? " จังหวัด " + profile.currentProvince.name : "") + profile.currentZipCode - : "", - oc: oc, + : "-", + oc: oc ?? "-", root: profile?.current_holders?.find( (x) => @@ -4269,9 +4276,12 @@ export class OrganizationDotnetController extends Controller { x.orgRevision?.orgRevisionIsCurrent == true, )?.orgChild4?.orgChild4Name ?? null, positions: _position && _position.length > 0 - ? _position.map((x:any) => ({ + ? _position + .slice(0, -1) + .map((x:any, idx: number) => ({ positionName: x.positionName, - date: x.commandDateAffect, + dateStart: x.commandDateAffect ?? null, + dateEnd: _position[idx + 1]?.commandDateAffect ?? null, positionType: x.positionType, positionLevel: x.positionLevel, orgRoot: x.orgRoot, @@ -4284,9 +4294,9 @@ export class OrganizationDotnetController extends Controller { educations: profile.profileEducations && profile.profileEducations.length > 0 ? profile.profileEducations.map(x => ({ educationLevel: x.educationLevel, - institute: x.institute, - country: x.country, - finishDate: x.finishDate, + institute: x.institute ?? "-", + country: x.country ?? "-", + finishDate: x.finishDate ?? "-", })) : [] }; @@ -4315,16 +4325,17 @@ export class OrganizationDotnetController extends Controller { const _position = position.length > 0 ? position[0] : []; const mapProfile = { - birthDate: profile.birthDate ?? null, - retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : null, - govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "", - age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "", - dateAppoint: profile.dateAppoint, - amount: profile.amount, - telephoneNumber: profile.telephoneNumber ?? null, - positionName: profile.position, - posLevel: profile.posLevel?.posLevelName ?? null, - posType: profile.posType?.posTypeName ?? null, + birthDate: profile.birthDate ?? "-", + retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-", + govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "-", + age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-", + dateAppoint: profile.dateAppoint ?? "-", + dateCurrent: new Date(), + amount: profile.amount ?? "-", + telephoneNumber: profile.telephoneNumber ?? "-", + positionName: profile.position ?? "-", + posLevel: profile.posLevel?.posLevelName ?? "-", + posType: profile.posType?.posTypeName ?? "-", currentAddress: profile && profile.currentAddress ? profile.currentAddress + (profile.currentSubDistrict && profile.currentSubDistrict.name @@ -4334,8 +4345,8 @@ export class OrganizationDotnetController extends Controller { (profile.currentProvince && profile.currentProvince.name ? " จังหวัด " + profile.currentProvince.name : "") + profile.currentZipCode - : "", - oc: oc, + : "-", + oc: oc ?? "-", root: profile?.current_holders?.find( (x) => @@ -4367,9 +4378,12 @@ export class OrganizationDotnetController extends Controller { x.orgRevision?.orgRevisionIsCurrent == true, )?.orgChild4?.orgChild4Name ?? null, positions: _position && _position.length > 0 - ? _position.map((x:any) => ({ + ? _position + .slice(0, -1) + .map((x:any, idx: number) => ({ positionName: x.positionName, - date: x.commandDateAffect, + dateStart: x.commandDateAffect ?? null, + dateEnd: _position[idx + 1]?.commandDateAffect ?? null, positionType: x.positionType, positionLevel: x.positionLevel, orgRoot: x.orgRoot, @@ -4382,9 +4396,9 @@ export class OrganizationDotnetController extends Controller { educations: profile.profileEducations && profile.profileEducations.length > 0 ? profile.profileEducations.map(x => ({ educationLevel: x.educationLevel, - institute: x.institute, - country: x.country, - finishDate: x.finishDate, + institute: x.institute ?? "-", + country: x.country ?? "-", + finishDate: x.finishDate ?? "-", })) : [] }; From e095e3693a16c60817f3f383456b34582c5ba58e Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 6 May 2025 13:10:09 +0700 Subject: [PATCH 3/3] no message --- src/controllers/OrganizationDotnetController.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index a9b68243..46665d7b 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -4225,7 +4225,7 @@ export class OrganizationDotnetController extends Controller { retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-", govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "-", age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-", - dateAppoint: profile.dateAppoint ?? "-", + dateAppoint: profile.dateAppoint, dateCurrent: new Date(), amount: profile.amount ?? "-", telephoneNumber: profile.telephoneNumber ?? "-", @@ -4296,7 +4296,7 @@ export class OrganizationDotnetController extends Controller { educationLevel: x.educationLevel, institute: x.institute ?? "-", country: x.country ?? "-", - finishDate: x.finishDate ?? "-", + finishDate: x.finishDate, })) : [] }; @@ -4329,7 +4329,7 @@ export class OrganizationDotnetController extends Controller { retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-", govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "-", age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-", - dateAppoint: profile.dateAppoint ?? "-", + dateAppoint: profile.dateAppoint, dateCurrent: new Date(), amount: profile.amount ?? "-", telephoneNumber: profile.telephoneNumber ?? "-", @@ -4398,7 +4398,7 @@ export class OrganizationDotnetController extends Controller { educationLevel: x.educationLevel, institute: x.institute ?? "-", country: x.country ?? "-", - finishDate: x.finishDate ?? "-", + finishDate: x.finishDate, })) : [] };