From 93b0dff070bb893fe9b94df3dc7fa534c902caac Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 15 Nov 2024 11:34:42 +0700 Subject: [PATCH] no message --- .../OrganizationDotnetController.ts | 86 ++++++++++++++----- 1 file changed, 64 insertions(+), 22 deletions(-) diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index dbcd8a21..b6308228 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -330,7 +330,7 @@ export class OrganizationDotnetController extends Controller { let fullname = ""; let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -344,12 +344,16 @@ export class OrganizationDotnetController extends Controller { orgChild4Id: org?.child4 ?? "", }, }); - + if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -364,10 +368,14 @@ export class OrganizationDotnetController extends Controller { }, }); if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -382,10 +390,14 @@ export class OrganizationDotnetController extends Controller { }, }); if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -400,10 +412,14 @@ export class OrganizationDotnetController extends Controller { }, }); if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -417,7 +433,11 @@ export class OrganizationDotnetController extends Controller { }, }); if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { fullname = ""; } @@ -455,7 +475,7 @@ export class OrganizationDotnetController extends Controller { let fullname = ""; let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -469,12 +489,16 @@ export class OrganizationDotnetController extends Controller { orgChild4Id: org?.child4 ?? "", }, }); - + if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -489,10 +513,14 @@ export class OrganizationDotnetController extends Controller { }, }); if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -507,10 +535,14 @@ export class OrganizationDotnetController extends Controller { }, }); if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -525,10 +557,14 @@ export class OrganizationDotnetController extends Controller { }, }); if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { let pos = await this.posMasterRepository.findOne({ - relations: ['current_holder'], + relations: ["current_holder"], where: { orgRevision: { orgRevisionIsCurrent: true, @@ -542,7 +578,11 @@ export class OrganizationDotnetController extends Controller { }, }); if (pos) { - fullname = pos.current_holder.prefix + pos.current_holder.firstName + " " + pos.current_holder.lastName; + fullname = + pos.current_holder.prefix + + pos.current_holder.firstName + + " " + + pos.current_holder.lastName; } else { fullname = ""; } @@ -628,6 +668,7 @@ export class OrganizationDotnetController extends Controller { posType: profile.posType ? profile.posType : null, profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null, profileInsignia: profile.profileInsignias.length > 0 ? profile.profileInsignias[0] : null, + profileType: "EMPLOYEE", }; return new HttpSuccess(mapProfile); @@ -710,6 +751,7 @@ export class OrganizationDotnetController extends Controller { posType: profile.posType ? profile.posType : null, profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null, profileInsignia: profile.profileInsignias.length > 0 ? profile.profileInsignias[0] : null, + profileType: "OFFICER", }; return new HttpSuccess(mapProfile);