diff --git a/src/controllers/ProfileAbilityController.ts b/src/controllers/ProfileAbilityController.ts index ddef5d14..3a9fbbcf 100644 --- a/src/controllers/ProfileAbilityController.ts +++ b/src/controllers/ProfileAbilityController.ts @@ -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(); } diff --git a/src/controllers/ProfileAbilityEmployeeController.ts b/src/controllers/ProfileAbilityEmployeeController.ts index eca1b434..5ef31b5f 100644 --- a/src/controllers/ProfileAbilityEmployeeController.ts +++ b/src/controllers/ProfileAbilityEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileAbilityEmployeeTempController.ts b/src/controllers/ProfileAbilityEmployeeTempController.ts index 723b3fa5..20dfb658 100644 --- a/src/controllers/ProfileAbilityEmployeeTempController.ts +++ b/src/controllers/ProfileAbilityEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileAssessmentsController.ts b/src/controllers/ProfileAssessmentsController.ts index a6b68b9f..d10a53fe 100644 --- a/src/controllers/ProfileAssessmentsController.ts +++ b/src/controllers/ProfileAssessmentsController.ts @@ -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(); } diff --git a/src/controllers/ProfileAssessmentsEmployeeController.ts b/src/controllers/ProfileAssessmentsEmployeeController.ts index df548051..6a541533 100644 --- a/src/controllers/ProfileAssessmentsEmployeeController.ts +++ b/src/controllers/ProfileAssessmentsEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileAssessmentsEmployeeTempController.ts b/src/controllers/ProfileAssessmentsEmployeeTempController.ts index c420bd1d..b18d4436 100644 --- a/src/controllers/ProfileAssessmentsEmployeeTempController.ts +++ b/src/controllers/ProfileAssessmentsEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileCertificateController.ts b/src/controllers/ProfileCertificateController.ts index 085d21f7..76002fda 100644 --- a/src/controllers/ProfileCertificateController.ts +++ b/src/controllers/ProfileCertificateController.ts @@ -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(); } diff --git a/src/controllers/ProfileCertificateEmployeeController.ts b/src/controllers/ProfileCertificateEmployeeController.ts index 7327d0ea..d832f095 100644 --- a/src/controllers/ProfileCertificateEmployeeController.ts +++ b/src/controllers/ProfileCertificateEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileCertificateEmployeeTempController.ts b/src/controllers/ProfileCertificateEmployeeTempController.ts index 86f1b011..4d89a8af 100644 --- a/src/controllers/ProfileCertificateEmployeeTempController.ts +++ b/src/controllers/ProfileCertificateEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileChangeNameController.ts b/src/controllers/ProfileChangeNameController.ts index 2fff7871..069adac3 100644 --- a/src/controllers/ProfileChangeNameController.ts +++ b/src/controllers/ProfileChangeNameController.ts @@ -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; diff --git a/src/controllers/ProfileChangeNameEmployeeController.ts b/src/controllers/ProfileChangeNameEmployeeController.ts index f3fec960..e96a8058 100644 --- a/src/controllers/ProfileChangeNameEmployeeController.ts +++ b/src/controllers/ProfileChangeNameEmployeeController.ts @@ -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; diff --git a/src/controllers/ProfileChangeNameEmployeeTempController.ts b/src/controllers/ProfileChangeNameEmployeeTempController.ts index 5d0307e9..59dd0a1d 100644 --- a/src/controllers/ProfileChangeNameEmployeeTempController.ts +++ b/src/controllers/ProfileChangeNameEmployeeTempController.ts @@ -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; diff --git a/src/controllers/ProfileChildrenController.ts b/src/controllers/ProfileChildrenController.ts index 7d167b27..f2a1ad73 100644 --- a/src/controllers/ProfileChildrenController.ts +++ b/src/controllers/ProfileChildrenController.ts @@ -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(); } diff --git a/src/controllers/ProfileChildrenEmployeeController.ts b/src/controllers/ProfileChildrenEmployeeController.ts index 26cb109b..735ad49a 100644 --- a/src/controllers/ProfileChildrenEmployeeController.ts +++ b/src/controllers/ProfileChildrenEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileChildrenEmployeeTempController.ts b/src/controllers/ProfileChildrenEmployeeTempController.ts index e217b582..77d9fcc1 100644 --- a/src/controllers/ProfileChildrenEmployeeTempController.ts +++ b/src/controllers/ProfileChildrenEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileDisciplineController.ts b/src/controllers/ProfileDisciplineController.ts index e7866e2e..32adf030 100644 --- a/src/controllers/ProfileDisciplineController.ts +++ b/src/controllers/ProfileDisciplineController.ts @@ -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(); } diff --git a/src/controllers/ProfileDisciplineEmployeeController.ts b/src/controllers/ProfileDisciplineEmployeeController.ts index 8bc9f765..937ff937 100644 --- a/src/controllers/ProfileDisciplineEmployeeController.ts +++ b/src/controllers/ProfileDisciplineEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileDisciplineEmployeeTempController.ts b/src/controllers/ProfileDisciplineEmployeeTempController.ts index 13a46a7f..3b97231e 100644 --- a/src/controllers/ProfileDisciplineEmployeeTempController.ts +++ b/src/controllers/ProfileDisciplineEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileDutyController.ts b/src/controllers/ProfileDutyController.ts index 34fccb83..7cbe8265 100644 --- a/src/controllers/ProfileDutyController.ts +++ b/src/controllers/ProfileDutyController.ts @@ -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(); } diff --git a/src/controllers/ProfileDutyEmployeeController.ts b/src/controllers/ProfileDutyEmployeeController.ts index 6b6f9876..cdfb9f12 100644 --- a/src/controllers/ProfileDutyEmployeeController.ts +++ b/src/controllers/ProfileDutyEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileDutyEmployeeTempController.ts b/src/controllers/ProfileDutyEmployeeTempController.ts index 5ffdfaac..5948e892 100644 --- a/src/controllers/ProfileDutyEmployeeTempController.ts +++ b/src/controllers/ProfileDutyEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileEducationsController.ts b/src/controllers/ProfileEducationsController.ts index 2b7689b5..48a76f74 100644 --- a/src/controllers/ProfileEducationsController.ts +++ b/src/controllers/ProfileEducationsController.ts @@ -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(); } diff --git a/src/controllers/ProfileEducationsEmployeeController.ts b/src/controllers/ProfileEducationsEmployeeController.ts index ec02db20..3a9a6f3a 100644 --- a/src/controllers/ProfileEducationsEmployeeController.ts +++ b/src/controllers/ProfileEducationsEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileEducationsEmployeeTempController.ts b/src/controllers/ProfileEducationsEmployeeTempController.ts index 33fb7dff..d832ed3c 100644 --- a/src/controllers/ProfileEducationsEmployeeTempController.ts +++ b/src/controllers/ProfileEducationsEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileFamilyCoupleController.ts b/src/controllers/ProfileFamilyCoupleController.ts index 378400cd..afdabed9 100644 --- a/src/controllers/ProfileFamilyCoupleController.ts +++ b/src/controllers/ProfileFamilyCoupleController.ts @@ -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); } diff --git a/src/controllers/ProfileFamilyCoupleEmployeeController.ts b/src/controllers/ProfileFamilyCoupleEmployeeController.ts index 3e906346..9e90c025 100644 --- a/src/controllers/ProfileFamilyCoupleEmployeeController.ts +++ b/src/controllers/ProfileFamilyCoupleEmployeeController.ts @@ -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); } diff --git a/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts b/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts index b577035f..cb4e518d 100644 --- a/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyCoupleEmployeeTempController.ts @@ -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); } diff --git a/src/controllers/ProfileFamilyFatherController.ts b/src/controllers/ProfileFamilyFatherController.ts index 4fcaeb88..0fd7eee0 100644 --- a/src/controllers/ProfileFamilyFatherController.ts +++ b/src/controllers/ProfileFamilyFatherController.ts @@ -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); } diff --git a/src/controllers/ProfileFamilyFatherEmployeeController.ts b/src/controllers/ProfileFamilyFatherEmployeeController.ts index 645048cb..b59b5f6e 100644 --- a/src/controllers/ProfileFamilyFatherEmployeeController.ts +++ b/src/controllers/ProfileFamilyFatherEmployeeController.ts @@ -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); } diff --git a/src/controllers/ProfileFamilyFatherEmployeeTempController.ts b/src/controllers/ProfileFamilyFatherEmployeeTempController.ts index a200f4ea..68937f4f 100644 --- a/src/controllers/ProfileFamilyFatherEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyFatherEmployeeTempController.ts @@ -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); } diff --git a/src/controllers/ProfileFamilyMotherController.ts b/src/controllers/ProfileFamilyMotherController.ts index b275837e..cdcfc5f0 100644 --- a/src/controllers/ProfileFamilyMotherController.ts +++ b/src/controllers/ProfileFamilyMotherController.ts @@ -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); } diff --git a/src/controllers/ProfileFamilyMotherEmployeeController.ts b/src/controllers/ProfileFamilyMotherEmployeeController.ts index 3f0d97ba..b49c0496 100644 --- a/src/controllers/ProfileFamilyMotherEmployeeController.ts +++ b/src/controllers/ProfileFamilyMotherEmployeeController.ts @@ -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); } diff --git a/src/controllers/ProfileFamilyMotherEmployeeTempController.ts b/src/controllers/ProfileFamilyMotherEmployeeTempController.ts index 3cd34967..7551c9a1 100644 --- a/src/controllers/ProfileFamilyMotherEmployeeTempController.ts +++ b/src/controllers/ProfileFamilyMotherEmployeeTempController.ts @@ -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); } diff --git a/src/controllers/ProfileHonorController.ts b/src/controllers/ProfileHonorController.ts index 9274b59c..bf31bc16 100644 --- a/src/controllers/ProfileHonorController.ts +++ b/src/controllers/ProfileHonorController.ts @@ -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(); } diff --git a/src/controllers/ProfileHonorEmployeeController.ts b/src/controllers/ProfileHonorEmployeeController.ts index 74c26ac3..730ea545 100644 --- a/src/controllers/ProfileHonorEmployeeController.ts +++ b/src/controllers/ProfileHonorEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileHonorEmployeeTempController.ts b/src/controllers/ProfileHonorEmployeeTempController.ts index 11b954c2..f728186a 100644 --- a/src/controllers/ProfileHonorEmployeeTempController.ts +++ b/src/controllers/ProfileHonorEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileInsigniaController.ts b/src/controllers/ProfileInsigniaController.ts index e455f124..6ed3216e 100644 --- a/src/controllers/ProfileInsigniaController.ts +++ b/src/controllers/ProfileInsigniaController.ts @@ -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(); } diff --git a/src/controllers/ProfileInsigniaEmployeeController.ts b/src/controllers/ProfileInsigniaEmployeeController.ts index 4b1e8944..689828c9 100644 --- a/src/controllers/ProfileInsigniaEmployeeController.ts +++ b/src/controllers/ProfileInsigniaEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileInsigniaEmployeeTempController.ts b/src/controllers/ProfileInsigniaEmployeeTempController.ts index 281c6523..6cbd3cc7 100644 --- a/src/controllers/ProfileInsigniaEmployeeTempController.ts +++ b/src/controllers/ProfileInsigniaEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileLeaveController.ts b/src/controllers/ProfileLeaveController.ts index cda9eaaa..0e56d39b 100644 --- a/src/controllers/ProfileLeaveController.ts +++ b/src/controllers/ProfileLeaveController.ts @@ -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(); } diff --git a/src/controllers/ProfileLeaveEmployeeController.ts b/src/controllers/ProfileLeaveEmployeeController.ts index a3d8ca97..520ca752 100644 --- a/src/controllers/ProfileLeaveEmployeeController.ts +++ b/src/controllers/ProfileLeaveEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileLeaveEmployeeTempController.ts b/src/controllers/ProfileLeaveEmployeeTempController.ts index cd379713..0a47d5f1 100644 --- a/src/controllers/ProfileLeaveEmployeeTempController.ts +++ b/src/controllers/ProfileLeaveEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileNopaidController.ts b/src/controllers/ProfileNopaidController.ts index dd37cc07..c6e7b2ba 100644 --- a/src/controllers/ProfileNopaidController.ts +++ b/src/controllers/ProfileNopaidController.ts @@ -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(); } diff --git a/src/controllers/ProfileNopaidEmployeeController.ts b/src/controllers/ProfileNopaidEmployeeController.ts index 0c26493f..d1b8a0be 100644 --- a/src/controllers/ProfileNopaidEmployeeController.ts +++ b/src/controllers/ProfileNopaidEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileNopaidEmployeeTempController.ts b/src/controllers/ProfileNopaidEmployeeTempController.ts index a0a0775a..b01384ad 100644 --- a/src/controllers/ProfileNopaidEmployeeTempController.ts +++ b/src/controllers/ProfileNopaidEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileOtherController.ts b/src/controllers/ProfileOtherController.ts index f3c74700..b64da50f 100644 --- a/src/controllers/ProfileOtherController.ts +++ b/src/controllers/ProfileOtherController.ts @@ -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(); } diff --git a/src/controllers/ProfileOtherEmployeeController.ts b/src/controllers/ProfileOtherEmployeeController.ts index 8581b247..f949b460 100644 --- a/src/controllers/ProfileOtherEmployeeController.ts +++ b/src/controllers/ProfileOtherEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileOtherEmployeeTempController.ts b/src/controllers/ProfileOtherEmployeeTempController.ts index cde9bcd2..b238c5bc 100644 --- a/src/controllers/ProfileOtherEmployeeTempController.ts +++ b/src/controllers/ProfileOtherEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileSalaryController.ts b/src/controllers/ProfileSalaryController.ts index 324f0301..fe72ce1b 100644 --- a/src/controllers/ProfileSalaryController.ts +++ b/src/controllers/ProfileSalaryController.ts @@ -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(); } diff --git a/src/controllers/ProfileSalaryEmployeeController.ts b/src/controllers/ProfileSalaryEmployeeController.ts index 5d04bc39..fbab07cd 100644 --- a/src/controllers/ProfileSalaryEmployeeController.ts +++ b/src/controllers/ProfileSalaryEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileSalaryEmployeeTempController.ts b/src/controllers/ProfileSalaryEmployeeTempController.ts index d7a167b4..0f0c93d9 100644 --- a/src/controllers/ProfileSalaryEmployeeTempController.ts +++ b/src/controllers/ProfileSalaryEmployeeTempController.ts @@ -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(); } diff --git a/src/controllers/ProfileTrainingController.ts b/src/controllers/ProfileTrainingController.ts index 930ee815..99972727 100644 --- a/src/controllers/ProfileTrainingController.ts +++ b/src/controllers/ProfileTrainingController.ts @@ -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(); } diff --git a/src/controllers/ProfileTrainingEmployeeController.ts b/src/controllers/ProfileTrainingEmployeeController.ts index 0b3e0c9e..4f2e5d77 100644 --- a/src/controllers/ProfileTrainingEmployeeController.ts +++ b/src/controllers/ProfileTrainingEmployeeController.ts @@ -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(); } diff --git a/src/controllers/ProfileTrainingEmployeeTempController.ts b/src/controllers/ProfileTrainingEmployeeTempController.ts index d2f24117..978112f2 100644 --- a/src/controllers/ProfileTrainingEmployeeTempController.ts +++ b/src/controllers/ProfileTrainingEmployeeTempController.ts @@ -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(); }