diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 3f304e2c..cfcc6f4b 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -81,6 +81,7 @@ export class ProfileController extends Controller { private disciplineRepository = AppDataSource.getRepository(ProfileDiscipline); private educationRepository = AppDataSource.getRepository(ProfileEducation); private salaryRepository = AppDataSource.getRepository(ProfileSalary); + private profileEducationRepository = AppDataSource.getRepository(ProfileEducation); /** * report ประวัติแบบย่อ ข้าราชการ @@ -2081,6 +2082,11 @@ export class ProfileController extends Controller { (x) => x.orgRevisionId == findRevision.id, )?.posMasterNo; + const latestProfileEducation = await this.profileEducationRepository.findOne({ + where: { profileId: item.id }, + order: { createdAt: "DESC" }, + }); + return { id: item.id, prefix: item.prefix, @@ -2092,6 +2098,7 @@ export class ProfileController extends Controller { email: item.email, phone: item.phone, name: fullName, + birthDate: item.birthDate, positionLevel: item.posLevelId, positionLevelName: item.posLevel?.posLevelName, positionType: item.posTypeId, @@ -2119,6 +2126,29 @@ export class ProfileController extends Controller { posTypeName: item.posType?.posTypeName, posLevelId: item.posLevelId, posLevelName: item.posLevel?.posLevelName, + profileEducation: latestProfileEducation + ? { + id: latestProfileEducation.id, + degree: latestProfileEducation.degree, + country: latestProfileEducation.country, + duration: latestProfileEducation.duration, + durationYear: latestProfileEducation.durationYear, + field: latestProfileEducation.field, + finishDate: latestProfileEducation.finishDate, + fundName: latestProfileEducation.fundName, + gpa: latestProfileEducation.gpa, + institute: latestProfileEducation.institute, + other: latestProfileEducation.other, + startDate: latestProfileEducation.startDate, + endDate: latestProfileEducation.endDate, + educationLevel: latestProfileEducation.educationLevel, + positionPath: latestProfileEducation.positionPath, + positionPathId: latestProfileEducation.positionPathId, + isDate: latestProfileEducation.isDate, + isEducation: latestProfileEducation.isEducation, + note: latestProfileEducation.note, + } + : null, }; }), ); diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 3cc72654..f509f1b2 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -97,6 +97,7 @@ export class ProfileEmployeeController extends Controller { private employmentHistoryRepository = AppDataSource.getRepository( ProfileEmployeeEmploymentHistory, ); + private profileEducationRepository = AppDataSource.getRepository(ProfileEducation); /** * report ประวัติแบบย่อ ลูกจ้าง @@ -1369,7 +1370,7 @@ export class ProfileEmployeeController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", + "profileSalarys", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -1503,6 +1504,11 @@ export class ProfileEmployeeController extends Controller { (x) => x.orgRevisionId == findRevision.id, )?.posMasterNo; + const latestProfileEducation = await this.profileEducationRepository.findOne({ + where: { profileEmployeeId: item.id }, + order: { createdAt: "DESC" }, + }); + return { id: item.id, prefix: item.prefix, @@ -1514,6 +1520,7 @@ export class ProfileEmployeeController extends Controller { email: item.email, phone: item.phone, name: fullName, + birthDate: item.birthDate, positionLevel: item.posLevelId, positionLevelName: item.posLevel?.posLevelName, positionType: item.posTypeId, @@ -1541,6 +1548,29 @@ export class ProfileEmployeeController extends Controller { posTypeName: item.posType?.posTypeName, posLevelId: item.posLevelId, posLevelName: item.posLevel?.posLevelName, + profileEducation: latestProfileEducation + ? { + id: latestProfileEducation.id, + degree: latestProfileEducation.degree, + country: latestProfileEducation.country, + duration: latestProfileEducation.duration, + durationYear: latestProfileEducation.durationYear, + field: latestProfileEducation.field, + finishDate: latestProfileEducation.finishDate, + fundName: latestProfileEducation.fundName, + gpa: latestProfileEducation.gpa, + institute: latestProfileEducation.institute, + other: latestProfileEducation.other, + startDate: latestProfileEducation.startDate, + endDate: latestProfileEducation.endDate, + educationLevel: latestProfileEducation.educationLevel, + positionPath: latestProfileEducation.positionPath, + positionPathId: latestProfileEducation.positionPathId, + isDate: latestProfileEducation.isDate, + isEducation: latestProfileEducation.isEducation, + note: latestProfileEducation.note, + } + : null, }; }), );