no message

This commit is contained in:
kittapath 2024-08-13 20:01:53 +07:00
parent 25b5d58f2a
commit 53787597fd
54 changed files with 219 additions and 332 deletions

View file

@ -153,13 +153,11 @@ export class ProfileAbilityController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileAbilityHistory();
history.profileAbilityId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileAbilityRepo.save(data),
(history.profileAbilityId = data.id),
this.profileAbilityHistoryRepo.save(history),
]);
await this.profileAbilityRepo.save(data);
history.profileAbilityId = data.id;
await this.profileAbilityHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -155,13 +155,11 @@ export class ProfileAbilityEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileAbilityHistory();
history.profileAbilityId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileAbilityRepo.save(data),
(history.profileAbilityId = data.id),
this.profileAbilityHistoryRepo.save(history),
]);
await this.profileAbilityRepo.save(data);
history.profileAbilityId = data.id;
await this.profileAbilityHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -155,13 +155,11 @@ export class ProfileAbilityEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileAbilityHistory();
history.profileAbilityId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileAbilityRepo.save(data),
(history.profileAbilityId = data.id),
this.profileAbilityHistoryRepo.save(history),
]);
await this.profileAbilityRepo.save(data);
history.profileAbilityId = data.id;
await this.profileAbilityHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -165,13 +165,11 @@ export class ProfileAssessmentsController extends Controller {
};
Object.assign(data, { ...body, ...meta });
const history = new ProfileAssessmentHistory();
history.profileAssessmentId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileAssessmentsRepository.save(data),
(history.profileAssessmentId = data.id),
this.profileAssessmentsHistoryRepository.save(history),
]);
await this.profileAssessmentsRepository.save(data);
history.profileAssessmentId = data.id;
await this.profileAssessmentsHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -167,13 +167,11 @@ export class ProfileAssessmentsEmployeeController extends Controller {
};
Object.assign(data, { ...body, ...meta });
const history = new ProfileAssessmentHistory();
history.profileAssessmentId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileAssessmentsRepository.save(data),
(history.profileAssessmentId = data.id),
this.profileAssessmentsHistoryRepository.save(history),
]);
await this.profileAssessmentsRepository.save(data);
history.profileAssessmentId = data.id;
await this.profileAssessmentsHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -167,13 +167,11 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
};
Object.assign(data, { ...body, ...meta });
const history = new ProfileAssessmentHistory();
history.profileAssessmentId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileAssessmentsRepository.save(data),
(history.profileAssessmentId = data.id),
this.profileAssessmentsHistoryRepository.save(history),
]);
await this.profileAssessmentsRepository.save(data);
history.profileAssessmentId = data.id;
await this.profileAssessmentsHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -143,13 +143,11 @@ export class ProfileCertificateController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileCertificateHistory();
history.profileCertificateId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.certificateRepo.save(data),
(history.profileCertificateId = data.id),
this.certificateHistoryRepo.save(history),
]);
await this.certificateRepo.save(data);
history.profileCertificateId = data.id;
await this.certificateHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -143,13 +143,11 @@ export class ProfileCertificateEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileCertificateHistory();
history.profileCertificateId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.certificateRepo.save(data),
(history.profileCertificateId = data.id),
this.certificateHistoryRepo.save(history),
]);
await this.certificateRepo.save(data);
history.profileCertificateId = data.id;
await this.certificateHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -143,13 +143,11 @@ export class ProfileCertificateEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileCertificateHistory();
history.profileCertificateId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.certificateRepo.save(data),
(history.profileCertificateId = data.id),
this.certificateHistoryRepo.save(history),
]);
await this.certificateRepo.save(data);
history.profileCertificateId = data.id;
await this.certificateHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -141,13 +141,11 @@ export class ProfileChangeNameController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileChangeNameHistory();
history.profileChangeNameId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.changeNameRepository.save(data),
(history.profileChangeNameId = data.id),
this.changeNameHistoryRepository.save(history),
]);
await this.changeNameRepository.save(data);
history.profileChangeNameId = data.id;
await this.changeNameHistoryRepository.save(history);
profile.firstName = body.firstName ?? profile.firstName;
profile.lastName = body.lastName ?? profile.lastName;

View file

@ -142,13 +142,11 @@ export class ProfileChangeNameEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileChangeNameHistory();
history.profileChangeNameId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.changeNameRepository.save(data),
(history.profileChangeNameId = data.id),
this.changeNameHistoryRepository.save(history),
]);
await this.changeNameRepository.save(data);
history.profileChangeNameId = data.id;
await this.changeNameHistoryRepository.save(history);
profile.firstName = body.firstName ?? profile.firstName;
profile.lastName = body.lastName ?? profile.lastName;

View file

@ -142,13 +142,11 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileChangeNameHistory();
history.profileChangeNameId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.changeNameRepository.save(data),
(history.profileChangeNameId = data.id),
this.changeNameHistoryRepository.save(history),
]);
await this.changeNameRepository.save(data);
history.profileChangeNameId = data.id;
await this.changeNameHistoryRepository.save(history);
profile.firstName = body.firstName ?? profile.firstName;
profile.lastName = body.lastName ?? profile.lastName;

View file

@ -84,13 +84,11 @@ export class ProfileChildrenController extends Controller {
data.childrenCitizenId = Extension.CheckCitizen(String(data.childrenCitizenId));
const history = new ProfileChildrenHistory();
history.profileChildrenId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.childrenRepository.save(data),
(history.profileChildrenId = data.id),
this.childrenHistoryRepository.save(history),
]);
await this.childrenRepository.save(data);
history.profileChildrenId = data.id;
await this.childrenHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -90,13 +90,11 @@ export class ProfileChildrenEmployeeController extends Controller {
data.childrenCitizenId = Extension.CheckCitizen(String(data.childrenCitizenId));
const history = new ProfileChildrenHistory();
history.profileChildrenId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.childrenRepository.save(data),
(history.profileChildrenId = data.id),
this.childrenHistoryRepository.save(history),
]);
await this.childrenRepository.save(data);
history.profileChildrenId = data.id;
await this.childrenHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -88,15 +88,12 @@ export class ProfileChildrenEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
data.childrenCitizenId = Extension.CheckCitizen(String(data.childrenCitizenId));
const history = new ProfileChildrenHistory();
history.profileChildrenId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.childrenRepository.save(data),
(history.profileChildrenId = data.id),
this.childrenHistoryRepository.save(history),
]);
await this.childrenRepository.save(data);
history.profileChildrenId = data.id;
await this.childrenHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -145,15 +145,12 @@ export class ProfileDisciplineController extends Controller {
};
Object.assign(data, { ...body, ...meta });
const history = new ProfileDisciplineHistory();
history.profileDisciplineId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.disciplineRepository.save(data),
(history.profileDisciplineId = data.id),
this.disciplineHistoryRepository.save(history),
]);
await this.disciplineRepository.save(data);
history.profileDisciplineId = data.id;
await this.disciplineHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -136,15 +136,12 @@ export class ProfileDisciplineEmployeeController extends Controller {
};
Object.assign(data, { ...body, ...meta });
const history = new ProfileDisciplineHistory();
history.profileDisciplineId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.disciplineRepository.save(data),
(history.profileDisciplineId = data.id),
this.disciplineHistoryRepository.save(history),
]);
await this.disciplineRepository.save(data);
history.profileDisciplineId = data.id;
await this.disciplineHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -136,15 +136,12 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
};
Object.assign(data, { ...body, ...meta });
const history = new ProfileDisciplineHistory();
history.profileDisciplineId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.disciplineRepository.save(data),
(history.profileDisciplineId = data.id),
this.disciplineHistoryRepository.save(history),
]);
await this.disciplineRepository.save(data);
history.profileDisciplineId = data.id;
await this.disciplineHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -150,13 +150,11 @@ export class ProfileDutyController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileDutyHistory();
history.profileDutyId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.dutyRepository.save(data),
(history.profileDutyId = data.id),
this.dutyHistoryRepository.save(history),
]);
await this.dutyRepository.save(data);
history.profileDutyId = data.id;
await this.dutyHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -111,13 +111,11 @@ export class ProfileDutyEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileDutyHistory();
history.profileDutyId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.dutyRepository.save(data),
(history.profileDutyId = data.id),
this.dutyHistoryRepository.save(history),
]);
await this.dutyRepository.save(data);
history.profileDutyId = data.id;
await this.dutyHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -111,13 +111,11 @@ export class ProfileDutyEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileDutyHistory();
history.profileDutyId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.dutyRepository.save(data),
(history.profileDutyId = data.id),
this.dutyHistoryRepository.save(history),
]);
await this.dutyRepository.save(data);
history.profileDutyId = data.id;
await this.dutyHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -200,15 +200,12 @@ export class ProfileEducationsController extends Controller {
};
Object.assign(data, { ...body, ...meta });
const history = new ProfileEducationHistory();
history.profileEducationId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileEducationRepo.save(data),
(history.profileEducationId = data.id),
this.profileEducationHistoryRepo.save(history),
]);
await this.profileEducationRepo.save(data);
history.profileEducationId = data.id;
await this.profileEducationHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -203,13 +203,11 @@ export class ProfileEducationsEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileEducationHistory();
history.profileEducationId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileEducationRepo.save(data),
(history.profileEducationId = data.id),
this.profileEducationHistoryRepo.save(history),
]);
await this.profileEducationRepo.save(data);
history.profileEducationId = data.id;
await this.profileEducationHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -203,13 +203,11 @@ export class ProfileEducationsEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileEducationHistory();
history.profileEducationId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.profileEducationRepo.save(data),
(history.profileEducationId = data.id),
this.profileEducationHistoryRepo.save(history),
]);
await this.profileEducationRepo.save(data);
history.profileEducationId = data.id;
await this.profileEducationHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -237,14 +237,12 @@ export class ProfileFamilyCoupleController extends Controller {
profile.relationship = familyCouple.relationship; //update profileEmployee.relationship
const history = new ProfileFamilyCoupleHistory();
history.profileFamilyCoupleId = familyCouple.id;
Object.assign(history, { ...familyCouple, id: undefined });
await Promise.all([
this.profileRepo.save(profile),
this.ProfileFamilyCouple.save(familyCouple),
(history.profileFamilyCoupleId = familyCouple.id),
this.ProfileFamilyCoupleHistory.save(history),
]);
await this.profileRepo.save(profile);
await this.ProfileFamilyCouple.save(familyCouple);
history.profileFamilyCoupleId = familyCouple.id;
await this.ProfileFamilyCoupleHistory.save(history);
return new HttpSuccess(familyCouple.id);
}

View file

@ -237,14 +237,12 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
profile.relationship = familyCouple.relationship; //update profileEmployee.relationship
const history = new ProfileFamilyCoupleHistory();
history.profileFamilyCoupleId = familyCouple.id;
Object.assign(history, { ...familyCouple, id: undefined });
await Promise.all([
this.profileRepo.save(profile),
this.ProfileFamilyCouple.save(familyCouple),
(history.profileFamilyCoupleId = familyCouple.id),
this.ProfileFamilyCoupleHistory.save(history),
]);
await this.profileRepo.save(profile);
await this.ProfileFamilyCouple.save(familyCouple);
history.profileFamilyCoupleId = familyCouple.id;
await this.ProfileFamilyCoupleHistory.save(history);
return new HttpSuccess(familyCouple.id);
}

View file

@ -238,14 +238,12 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
profile.relationship = familyCouple.relationship; //update profileEmployee.relationship
const history = new ProfileFamilyCoupleHistory();
history.profileFamilyCoupleId = familyCouple.id;
Object.assign(history, { ...familyCouple, id: undefined });
await Promise.all([
this.profileRepo.save(profile),
this.ProfileFamilyCouple.save(familyCouple),
(history.profileFamilyCoupleId = familyCouple.id),
this.ProfileFamilyCoupleHistory.save(history),
]);
await this.profileRepo.save(profile);
await this.ProfileFamilyCouple.save(familyCouple);
history.profileFamilyCoupleId = familyCouple.id;
await this.ProfileFamilyCoupleHistory.save(history);
return new HttpSuccess(familyCouple.id);
}

View file

@ -222,13 +222,11 @@ export class ProfileFamilyFatherController extends Controller {
familyFather.lastUpdateFullName = req.user.name;
const history = new ProfileFamilyFatherHistory();
history.profileFamilyFatherId = familyFather.id;
Object.assign(history, { ...familyFather, id: undefined });
await Promise.all([
this.ProfileFamilyFather.save(familyFather),
(history.profileFamilyFatherId = familyFather.id),
this.ProfileFamilyFatherHistory.save(history),
]);
await this.ProfileFamilyFather.save(familyFather);
history.profileFamilyFatherId = familyFather.id;
await this.ProfileFamilyFatherHistory.save(history);
return new HttpSuccess(familyFather.id);
}

View file

@ -222,13 +222,11 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
familyFather.lastUpdateFullName = req.user.name;
const history = new ProfileFamilyFatherHistory();
history.profileFamilyFatherId = familyFather.id;
Object.assign(history, { ...familyFather, id: undefined });
await Promise.all([
this.ProfileFamilyFather.save(familyFather),
(history.profileFamilyFatherId = familyFather.id),
this.ProfileFamilyFatherHistory.save(history),
]);
await this.ProfileFamilyFather.save(familyFather);
history.profileFamilyFatherId = familyFather.id;
await this.ProfileFamilyFatherHistory.save(history);
return new HttpSuccess(familyFather.id);
}

View file

@ -222,13 +222,11 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
familyFather.lastUpdateFullName = req.user.name;
const history = new ProfileFamilyFatherHistory();
history.profileFamilyFatherId = familyFather.id;
Object.assign(history, { ...familyFather, id: undefined });
await Promise.all([
this.ProfileFamilyFather.save(familyFather),
(history.profileFamilyFatherId = familyFather.id),
this.ProfileFamilyFatherHistory.save(history),
]);
await this.ProfileFamilyFather.save(familyFather);
history.profileFamilyFatherId = familyFather.id;
await this.ProfileFamilyFatherHistory.save(history);
return new HttpSuccess(familyFather.id);
}

View file

@ -222,13 +222,11 @@ export class ProfileFamilyMotherController extends Controller {
familyMother.lastUpdateFullName = req.user.name;
const history = new ProfileFamilyMotherHistory();
history.profileFamilyMotherId = familyMother.id;
Object.assign(history, { ...familyMother, id: undefined });
await Promise.all([
this.ProfileFamilyMother.save(familyMother),
(history.profileFamilyMotherId = familyMother.id),
this.ProfileFamilyMotherHistory.save(history),
]);
await this.ProfileFamilyMother.save(familyMother);
history.profileFamilyMotherId = familyMother.id;
await this.ProfileFamilyMotherHistory.save(history);
return new HttpSuccess(familyMother.id);
}

View file

@ -222,13 +222,11 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
familyMother.lastUpdateFullName = req.user.name;
const history = new ProfileFamilyMotherHistory();
history.profileFamilyMotherId = familyMother.id;
Object.assign(history, { ...familyMother, id: undefined });
await Promise.all([
this.ProfileFamilyMother.save(familyMother),
(history.profileFamilyMotherId = familyMother.id),
this.ProfileFamilyMotherHistory.save(history),
]);
await this.ProfileFamilyMother.save(familyMother);
history.profileFamilyMotherId = familyMother.id;
await this.ProfileFamilyMotherHistory.save(history);
return new HttpSuccess(familyMother.id);
}

View file

@ -222,13 +222,11 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
familyMother.lastUpdateFullName = req.user.name;
const history = new ProfileFamilyMotherHistory();
history.profileFamilyMotherId = familyMother.id;
Object.assign(history, { ...familyMother, id: undefined });
await Promise.all([
this.ProfileFamilyMother.save(familyMother),
(history.profileFamilyMotherId = familyMother.id),
this.ProfileFamilyMotherHistory.save(history),
]);
await this.ProfileFamilyMother.save(familyMother);
history.profileFamilyMotherId = familyMother.id;
await this.ProfileFamilyMotherHistory.save(history);
return new HttpSuccess(familyMother.id);
}

View file

@ -160,13 +160,11 @@ export class ProfileHonorController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileHonorHistory();
history.profileHonorId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.honorRepo.save(data),
(history.profileHonorId = data.id),
this.honorHistoryRepo.save(history),
]);
await this.honorRepo.save(data);
history.profileHonorId = data.id;
await this.honorHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -164,13 +164,11 @@ export class ProfileHonorEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileHonorHistory();
history.profileHonorId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.honorRepo.save(data),
(history.profileHonorId = data.id),
this.honorHistoryRepo.save(history),
]);
await this.honorRepo.save(data);
history.profileHonorId = data.id;
await this.honorHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -164,13 +164,11 @@ export class ProfileHonorEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileHonorHistory();
history.profileHonorId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.honorRepo.save(data),
(history.profileHonorId = data.id),
this.honorHistoryRepo.save(history),
]);
await this.honorRepo.save(data);
history.profileHonorId = data.id;
await this.honorHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -195,13 +195,11 @@ export class ProfileInsigniaController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileInsigniaHistory();
history.profileInsigniaId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.insigniaRepo.save(data),
(history.profileInsigniaId = data.id),
this.insigniaHistoryRepo.save(history),
]);
await this.insigniaRepo.save(data);
history.profileInsigniaId = data.id;
await this.insigniaHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -198,13 +198,11 @@ export class ProfileInsigniaEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileInsigniaHistory();
history.profileInsigniaId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.insigniaRepo.save(data),
(history.profileInsigniaId = data.id),
this.insigniaHistoryRepo.save(history),
]);
await this.insigniaRepo.save(data);
history.profileInsigniaId = data.id;
await this.insigniaHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -198,13 +198,11 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileInsigniaHistory();
history.profileInsigniaId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.insigniaRepo.save(data),
(history.profileInsigniaId = data.id),
this.insigniaHistoryRepo.save(history),
]);
await this.insigniaRepo.save(data);
history.profileInsigniaId = data.id;
await this.insigniaHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -275,13 +275,11 @@ export class ProfileLeaveController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileLeaveHistory();
history.profileLeaveId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.leaveRepo.save(data),
(history.profileLeaveId = data.id),
this.leaveHistoryRepo.save(history),
]);
await this.leaveRepo.save(data);
history.profileLeaveId = data.id;
await this.leaveHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -96,13 +96,11 @@ export class ProfileLeaveEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileLeaveHistory();
history.profileLeaveId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.leaveRepo.save(data),
(history.profileLeaveId = data.id),
this.leaveHistoryRepo.save(history),
]);
await this.leaveRepo.save(data);
history.profileLeaveId = data.id;
await this.leaveHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -96,13 +96,11 @@ export class ProfileLeaveEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileLeaveHistory();
history.profileLeaveId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.leaveRepo.save(data),
(history.profileLeaveId = data.id),
this.leaveHistoryRepo.save(history),
]);
await this.leaveRepo.save(data);
history.profileLeaveId = data.id;
await this.leaveHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -118,13 +118,11 @@ export class ProfileNopaidController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileNopaidHistory();
history.profileNopaidId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.nopaidRepository.save(data),
(history.profileNopaidId = data.id),
this.nopaidHistoryRepository.save(history),
]);
await this.nopaidRepository.save(data);
history.profileNopaidId = data.id;
await this.nopaidHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -89,13 +89,11 @@ export class ProfileNopaidEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileNopaidHistory();
history.profileNopaidId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.nopaidRepository.save(data),
(history.profileNopaidId = data.id),
this.nopaidHistoryRepository.save(history),
]);
await this.nopaidRepository.save(data);
history.profileNopaidId = data.id;
await this.nopaidHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -89,13 +89,11 @@ export class ProfileNopaidEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileNopaidHistory();
history.profileNopaidId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.nopaidRepository.save(data),
(history.profileNopaidId = data.id),
this.nopaidHistoryRepository.save(history),
]);
await this.nopaidRepository.save(data);
history.profileNopaidId = data.id;
await this.nopaidHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -115,13 +115,11 @@ export class ProfileOtherController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileOtherHistory();
history.profileOtherId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.otherRepository.save(data),
(history.profileOtherId = data.id),
this.otherHistoryRepository.save(history),
]);
await this.otherRepository.save(data);
history.profileOtherId = data.id;
await this.otherHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -86,13 +86,11 @@ export class ProfileOtherEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileOtherHistory();
history.profileOtherId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.otherRepository.save(data),
(history.profileOtherId = data.id),
this.otherHistoryRepository.save(history),
]);
await this.otherRepository.save(data);
history.profileOtherId = data.id;
await this.otherHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -86,13 +86,11 @@ export class ProfileOtherEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileOtherHistory();
history.profileOtherId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.otherRepository.save(data),
(history.profileOtherId = data.id),
this.otherHistoryRepository.save(history),
]);
await this.otherRepository.save(data);
history.profileOtherId = data.id;
await this.otherHistoryRepository.save(history);
return new HttpSuccess();
}

View file

@ -168,13 +168,11 @@ export class ProfileSalaryController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileSalaryHistory();
history.profileSalaryId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.salaryRepo.save(data),
(history.profileSalaryId = data.id),
this.salaryHistoryRepo.save(history),
]);
await this.salaryRepo.save(data);
history.profileSalaryId = data.id;
await this.salaryHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -97,13 +97,11 @@ export class ProfileSalaryEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileSalaryHistory();
history.profileSalaryId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.salaryRepo.save(data),
(history.profileSalaryId = data.id),
this.salaryHistoryRepo.save(history),
]);
await this.salaryRepo.save(data);
history.profileSalaryId = data.id;
await this.salaryHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -97,13 +97,11 @@ export class ProfileSalaryEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileSalaryHistory();
history.profileSalaryId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.salaryRepo.save(data),
(history.profileSalaryId = data.id),
this.salaryHistoryRepo.save(history),
]);
await this.salaryRepo.save(data);
history.profileSalaryId = data.id;
await this.salaryHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -161,13 +161,11 @@ export class ProfileTrainingController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileTrainingHistory();
history.profileTrainingId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.trainingRepo.save(data),
(history.profileTrainingId = data.id),
this.trainingHistoryRepo.save(history),
]);
await this.trainingRepo.save(data);
history.profileTrainingId = data.id;
await this.trainingHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -164,13 +164,11 @@ export class ProfileTrainingEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileTrainingHistory();
history.profileTrainingId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.trainingRepo.save(data),
(history.profileTrainingId = data.id),
this.trainingHistoryRepo.save(history),
]);
await this.trainingRepo.save(data);
history.profileTrainingId = data.id;
await this.trainingHistoryRepo.save(history);
return new HttpSuccess();
}

View file

@ -164,13 +164,11 @@ export class ProfileTrainingEmployeeTempController extends Controller {
Object.assign(data, { ...body, ...meta });
const history = new ProfileTrainingHistory();
history.profileTrainingId = data.id;
Object.assign(history, { ...data, id: undefined });
await Promise.all([
this.trainingRepo.save(data),
(history.profileTrainingId = data.id),
this.trainingHistoryRepo.save(history),
]);
await this.trainingRepo.save(data);
history.profileTrainingId = data.id;
await this.trainingHistoryRepo.save(history);
return new HttpSuccess();
}