ค้นหาลูกจ้าง

This commit is contained in:
kittapath 2024-10-30 16:35:12 +07:00
parent f3eadd867a
commit 7abd9eaef3

View file

@ -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,