diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 563ec950..22ebd41d 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -1519,7 +1519,10 @@ export class CommandController extends Controller { await Promise.all( response_.data.result.profiles.map(async (x: any) => { - const _profile = await this.profileRepository.findOneBy({ id: x.profileId }); + const _profile = await this.profileRepository.findOne({ + where: { id: x.profileId }, + relations: ["roleKeycloaks"], + }); if (_profile) { // console.log("1. บันทึกลงประวัติตำแหน่ง") await this.profileSalaryRetire(x.profileId, type, signDate, _Date); @@ -1572,7 +1575,10 @@ export class CommandController extends Controller { await Promise.all( response_.data.result.profiles.map(async (x: any) => { - const _profileEmp = await this.profileEmployeeRepository.findOneBy({ id: x.profileId }); + const _profileEmp = await this.profileEmployeeRepository.findOne({ + where: { id: x.profileId }, + relations: ["roleKeycloaks"], + }); if (_profileEmp) { // บันทึกลงประวัติตำแหน่ง await this.profileSalaryRetire(x.profileId, type, signDate, _Date); @@ -4694,6 +4700,7 @@ export class CommandController extends Controller { if (item.isLeave != null) { const _profile = await this.profileRepository.findOne({ where: { id: item.profileId }, + relations: ["roleKeycloaks"], }); if (!_profile) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้"); @@ -4896,6 +4903,7 @@ export class CommandController extends Controller { if (item.isLeave != null) { const _profile = await this.profileEmployeeRepository.findOne({ where: { id: item.profileId }, + relations: ["roleKeycloaks"], }); if (!_profile) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้"); @@ -5188,6 +5196,7 @@ export class CommandController extends Controller { if (item.isLeave != null) { const _profile = await this.profileEmployeeRepository.findOne({ where: { id: item.profileId }, + relations: ["roleKeycloaks"], }); if (!_profile) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้"); @@ -5889,7 +5898,7 @@ export class CommandController extends Controller { //กรณีลูกจ้างประจำมาสอบเป็นข้าราชการ ต้อง update สถานะโปรไฟล์เดิม let profileEmployee: any = await this.profileEmployeeRepository.findOne({ where: { citizenId: item.bodyProfile.citizenId }, - relations: ["profileInsignias"], + relations: ["profileInsignias", "roleKeycloaks"], }); if (profileEmployee) { const _order = await this.salaryRepo.findOne({