From 7abd9eaef30939d41aeb6c6be925a608f8136719 Mon Sep 17 00:00:00 2001 From: kittapath Date: Wed, 30 Oct 2024 16:35:12 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=84=E0=B9=89=E0=B8=99=E0=B8=AB=E0=B8=B2?= =?UTF-8?q?=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OrganizationDotnetController.ts | 71 ++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index ee6624e2..b9944113 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -441,7 +441,76 @@ export class OrganizationDotnetController extends Controller { }, }, }); - if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); + if (!profile) { + const _profile = await this.profileEmpRepo.findOne({ + relations: { + posLevel: true, + posType: true, + profileSalarys: true, + profileInsignias: true, + }, + where: { citizenId: citizenId }, + order: { + profileSalarys: { + date: "DESC", + }, + profileInsignias: { + receiveDate: "DESC", + }, + }, + }); + + if (!_profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); + const _mapProfile = { + id: _profile.id, + avatar: _profile.avatar, + avatarName: _profile.avatarName, + rank: _profile.rank, + prefix: _profile.prefix, + firstName: _profile.firstName, + lastName: _profile.lastName, + citizenId: _profile.citizenId, + position: _profile.position, + posLevelId: _profile.posLevelId, + email: _profile.email, + phone: _profile.phone, + keycloak: _profile.keycloak, + isProbation: _profile.isProbation, + isLeave: _profile.isLeave, + leaveReason: _profile.leaveReason, + dateRetire: _profile.dateRetire, + dateAppoint: _profile.dateAppoint, + dateRetireLaw: _profile.dateRetireLaw, + dateStart: _profile.dateStart, + govAgeAbsent: _profile.govAgeAbsent, + govAgePlus: _profile.govAgePlus, + birthDate: _profile.birthDate, + reasonSameDate: _profile.reasonSameDate, + telephoneNumber: _profile.telephoneNumber, + nationality: _profile.nationality, + gender: _profile.gender, + relationship: _profile.relationship, + religion: _profile.religion, + bloodGroup: _profile.bloodGroup, + registrationAddress: _profile.registrationAddress, + registrationProvinceId: _profile.registrationProvinceId, + registrationDistrictId: _profile.registrationDistrictId, + registrationSubDistrictId: _profile.registrationSubDistrictId, + registrationZipCode: _profile.registrationZipCode, + currentAddress: _profile.currentAddress, + currentProvinceId: _profile.currentProvinceId, + currentSubDistrictId: _profile.currentSubDistrictId, + currentZipCode: _profile.currentZipCode, + dutyTimeId: null, + dutyTimeEffectiveDate: null, + posLevel: _profile.posLevel ? _profile.posLevel : null, + posType: _profile.posType ? _profile.posType : null, + profileSalary: _profile.profileSalarys, + profileInsignia: _profile.profileInsignias, + profileType: "EMPLOYEE", + }; + return new HttpSuccess(_mapProfile); + } const mapProfile = { id: profile.id,