no message

This commit is contained in:
Bright 2024-10-10 13:07:10 +07:00
parent e43c29dbc4
commit 8eb643c435

View file

@ -2039,13 +2039,13 @@ export class CommandController extends Controller {
body: { body: {
data: { data: {
bodyProfile: CreateProfileAllFields; bodyProfile: CreateProfileAllFields;
bodyEducations: CreateProfileEducation[]; bodyEducations?: CreateProfileEducation[];
bodyCertificates: CreateProfileCertificate[]; bodyCertificates?: CreateProfileCertificate[];
bodySalarys: CreateProfileSalary; bodySalarys?: CreateProfileSalary | null;
bodyPosition: { bodyPosition?: {
posmasterId: string; posmasterId: string;
positionId: string; positionId: string;
}; } | null;
}[]; }[];
}, },
) { ) {
@ -2101,9 +2101,9 @@ export class CommandController extends Controller {
await this.profileRepository.save(profile); await this.profileRepository.save(profile);
setLogDataDiff(req, { before, after: profile }); setLogDataDiff(req, { before, after: profile });
} }
if(profile && profile.id) { if(profile && profile.id) {
//Educations //Educations
if(item.bodyEducations && item.bodyEducations.length > 0) {
await Promise.all( await Promise.all(
item.bodyEducations.map(async (education) => { item.bodyEducations.map(async (education) => {
const profileEdu = new ProfileEducation(); const profileEdu = new ProfileEducation();
@ -2117,7 +2117,10 @@ export class CommandController extends Controller {
await this.profileEducationHistoryRepo.save(eduHistory, { data: req }); await this.profileEducationHistoryRepo.save(eduHistory, { data: req });
}), }),
); );
}
//Certificates //Certificates
if(item.bodyCertificates && item.bodyCertificates.length > 0) {
await Promise.all( await Promise.all(
item.bodyCertificates.map(async (cer) => { item.bodyCertificates.map(async (cer) => {
const profileCer = new ProfileCertificate(); const profileCer = new ProfileCertificate();
@ -2131,7 +2134,10 @@ export class CommandController extends Controller {
await this.certificateHistoryRepo.save(cerHistory, { data: req }); await this.certificateHistoryRepo.save(cerHistory, { data: req });
}), }),
); );
}
//Salary //Salary
if(item.bodySalarys && item.bodySalarys != null) {
const dest_item = await this.salaryRepo.findOne({ const dest_item = await this.salaryRepo.findOne({
where: { profileId: profile.id }, where: { profileId: profile.id },
order: { order: "DESC" }, order: { order: "DESC" },
@ -2146,7 +2152,10 @@ export class CommandController extends Controller {
setLogDataDiff(req, { before, after: profileSal }); setLogDataDiff(req, { before, after: profileSal });
salaryHistory.profileSalaryId = profileSal.id; salaryHistory.profileSalaryId = profileSal.id;
await this.salaryHistoryRepo.save(salaryHistory, { data: req }); await this.salaryHistoryRepo.save(salaryHistory, { data: req });
}
//Position //Position
if(item.bodyPosition && item.bodyPosition != null) {
const posMaster = await this.posMasterRepository.findOne({ const posMaster = await this.posMasterRepository.findOne({
where: { id: item.bodyPosition.posmasterId }, where: { id: item.bodyPosition.posmasterId },
}); });
@ -2206,6 +2215,7 @@ export class CommandController extends Controller {
await this.positionRepository.save(positionNew, { data: req }); await this.positionRepository.save(positionNew, { data: req });
} }
} }
}
}), }),
); );
return new HttpSuccess(); return new HttpSuccess();