sort edu by level
This commit is contained in:
parent
4b05629c29
commit
587fe5d5b6
11 changed files with 229 additions and 266 deletions
|
|
@ -42,7 +42,7 @@ import { HR_PERSONAL_EMP_FAMILY } from "../entities/HR_PERSONAL_EMP_FAMILY";
|
|||
@Tags("UPLOAD")
|
||||
@Security("bearerAuth")
|
||||
export class ImportDataController extends Controller {
|
||||
private educationRepository = AppDataSource.getRepository(ProfileEducation);
|
||||
private profileEducationRepo = AppDataSource.getRepository(ProfileEducation);
|
||||
private profileFamilyCoupleRepository = AppDataSource.getRepository(ProfileFamilyCouple);
|
||||
private profileFamilyMotherRepository = AppDataSource.getRepository(ProfileFamilyMother);
|
||||
private profileFamilyFatherRepository = AppDataSource.getRepository(ProfileFamilyFather);
|
||||
|
|
@ -762,6 +762,12 @@ export class ImportDataController extends Controller {
|
|||
select: ["CIT", "EDUCATION_CODE", "START_EDUCATION_YEAR", "EDUCATION_YEAR", "INSTITUE"],
|
||||
});
|
||||
|
||||
const educationLevel = await this.profileEducationRepo.findOne({
|
||||
select: ["id", "level", "profileId"],
|
||||
where: { profileId: _item.id },
|
||||
order: { level: "DESC" },
|
||||
});
|
||||
|
||||
// educations = await [];
|
||||
await Promise.all(
|
||||
existingProfile.map(async (item) => {
|
||||
|
|
@ -781,6 +787,7 @@ export class ImportDataController extends Controller {
|
|||
: null_;
|
||||
// endDate = endDate ? new Date(endDate, 0, 1) : null_;
|
||||
|
||||
education.level = educationLevel == null ? 1 : educationLevel.level + 1;
|
||||
education.profileId = _item.id;
|
||||
education.degree = educationCode ? educationCode.EDUCATION_NAME : "";
|
||||
education.institute = item.INSTITUE;
|
||||
|
|
@ -794,16 +801,16 @@ export class ImportDataController extends Controller {
|
|||
education.lastUpdatedAt = new Date();
|
||||
// await educations.push(await education);
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.educationRepository.save(await education);
|
||||
await this.profileEducationRepo.save(await education);
|
||||
}),
|
||||
);
|
||||
// await this.educationRepository.save(educations);
|
||||
// await this.profileEducationRepo.save(educations);
|
||||
// educations = await [];
|
||||
}),
|
||||
);
|
||||
// }
|
||||
// console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
// await this.educationRepository.save(educations);
|
||||
// await this.profileEducationRepo.save(educations);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -838,6 +845,12 @@ export class ImportDataController extends Controller {
|
|||
select: ["CIT", "EDUCATION_CODE", "START_EDUCATION_YEAR", "EDUCATION_YEAR", "INSTITUE"],
|
||||
});
|
||||
|
||||
const educationLevel = await this.profileEducationRepo.findOne({
|
||||
select: ["id", "level", "profileId"],
|
||||
where: { profileEmployeeId: _item.id },
|
||||
order: { level: "DESC" },
|
||||
});
|
||||
|
||||
educations = await [];
|
||||
await Promise.all(
|
||||
existingProfile.map(async (item) => {
|
||||
|
|
@ -857,6 +870,7 @@ export class ImportDataController extends Controller {
|
|||
: null_;
|
||||
// endDate = endDate ? new Date(endDate, 0, 1) : null_;
|
||||
|
||||
education.level = educationLevel == null ? 1 : educationLevel.level + 1;
|
||||
education.profileEmployeeId = _item.id;
|
||||
education.degree = educationCode ? educationCode.EDUCATION_NAME : "";
|
||||
education.institute = item.INSTITUE;
|
||||
|
|
@ -870,15 +884,15 @@ export class ImportDataController extends Controller {
|
|||
education.lastUpdatedAt = new Date();
|
||||
// educations.push(education);
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.educationRepository.save(education);
|
||||
await this.profileEducationRepo.save(education);
|
||||
}),
|
||||
);
|
||||
// await this.educationRepository.save(educations);
|
||||
// await this.profileEducationRepo.save(educations);
|
||||
}),
|
||||
);
|
||||
// }
|
||||
// console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
// await this.educationRepository.save(educations);
|
||||
// await this.profileEducationRepo.save(educations);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue