add field search-personal both

This commit is contained in:
AdisakKanthawilang 2024-06-12 17:50:48 +07:00
parent 681b0aa326
commit cd456516c0
2 changed files with 61 additions and 1 deletions

View file

@ -81,6 +81,7 @@ export class ProfileController extends Controller {
private disciplineRepository = AppDataSource.getRepository(ProfileDiscipline); private disciplineRepository = AppDataSource.getRepository(ProfileDiscipline);
private educationRepository = AppDataSource.getRepository(ProfileEducation); private educationRepository = AppDataSource.getRepository(ProfileEducation);
private salaryRepository = AppDataSource.getRepository(ProfileSalary); private salaryRepository = AppDataSource.getRepository(ProfileSalary);
private profileEducationRepository = AppDataSource.getRepository(ProfileEducation);
/** /**
* report * report
@ -2081,6 +2082,11 @@ export class ProfileController extends Controller {
(x) => x.orgRevisionId == findRevision.id, (x) => x.orgRevisionId == findRevision.id,
)?.posMasterNo; )?.posMasterNo;
const latestProfileEducation = await this.profileEducationRepository.findOne({
where: { profileId: item.id },
order: { createdAt: "DESC" },
});
return { return {
id: item.id, id: item.id,
prefix: item.prefix, prefix: item.prefix,
@ -2092,6 +2098,7 @@ export class ProfileController extends Controller {
email: item.email, email: item.email,
phone: item.phone, phone: item.phone,
name: fullName, name: fullName,
birthDate: item.birthDate,
positionLevel: item.posLevelId, positionLevel: item.posLevelId,
positionLevelName: item.posLevel?.posLevelName, positionLevelName: item.posLevel?.posLevelName,
positionType: item.posTypeId, positionType: item.posTypeId,
@ -2119,6 +2126,29 @@ export class ProfileController extends Controller {
posTypeName: item.posType?.posTypeName, posTypeName: item.posType?.posTypeName,
posLevelId: item.posLevelId, posLevelId: item.posLevelId,
posLevelName: item.posLevel?.posLevelName, 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,
}; };
}), }),
); );

View file

@ -97,6 +97,7 @@ export class ProfileEmployeeController extends Controller {
private employmentHistoryRepository = AppDataSource.getRepository( private employmentHistoryRepository = AppDataSource.getRepository(
ProfileEmployeeEmploymentHistory, ProfileEmployeeEmploymentHistory,
); );
private profileEducationRepository = AppDataSource.getRepository(ProfileEducation);
/** /**
* report * report
@ -1369,7 +1370,7 @@ export class ProfileEmployeeController extends Controller {
"posType", "posType",
"posLevel", "posLevel",
"current_holders", "current_holders",
"profileSalary", "profileSalarys",
"current_holders.orgRoot", "current_holders.orgRoot",
"current_holders.orgChild1", "current_holders.orgChild1",
"current_holders.orgChild2", "current_holders.orgChild2",
@ -1503,6 +1504,11 @@ export class ProfileEmployeeController extends Controller {
(x) => x.orgRevisionId == findRevision.id, (x) => x.orgRevisionId == findRevision.id,
)?.posMasterNo; )?.posMasterNo;
const latestProfileEducation = await this.profileEducationRepository.findOne({
where: { profileEmployeeId: item.id },
order: { createdAt: "DESC" },
});
return { return {
id: item.id, id: item.id,
prefix: item.prefix, prefix: item.prefix,
@ -1514,6 +1520,7 @@ export class ProfileEmployeeController extends Controller {
email: item.email, email: item.email,
phone: item.phone, phone: item.phone,
name: fullName, name: fullName,
birthDate: item.birthDate,
positionLevel: item.posLevelId, positionLevel: item.posLevelId,
positionLevelName: item.posLevel?.posLevelName, positionLevelName: item.posLevel?.posLevelName,
positionType: item.posTypeId, positionType: item.posTypeId,
@ -1541,6 +1548,29 @@ export class ProfileEmployeeController extends Controller {
posTypeName: item.posType?.posTypeName, posTypeName: item.posType?.posTypeName,
posLevelId: item.posLevelId, posLevelId: item.posLevelId,
posLevelName: item.posLevel?.posLevelName, 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,
}; };
}), }),
); );