fix: run temp to profileSalary
All checks were successful
Build & Deploy on Dev / build (push) Successful in 53s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 53s
This commit is contained in:
parent
af466df0d0
commit
203ec6cb84
1 changed files with 12 additions and 0 deletions
|
|
@ -1326,6 +1326,7 @@ export class ProfileSalaryTempController extends Controller {
|
|||
* 3. Split Update / Insert
|
||||
* ========================= */
|
||||
// const toUpdate = salaryTemps.filter((t) => t.salaryId && t.isEdit && !t.isDelete);
|
||||
const backupTemp = salaryTemps;
|
||||
const toInsert = salaryTemps.filter((t) => !t.isDelete);
|
||||
const dateNow = new Date();
|
||||
const metaUpdate = {
|
||||
|
|
@ -1339,6 +1340,8 @@ export class ProfileSalaryTempController extends Controller {
|
|||
...(isOfficer ? { profileId: body.profileId } : { profileEmployeeId: body.profileId }),
|
||||
});
|
||||
|
||||
// add insert to profile salary backup
|
||||
|
||||
// delete profile salary
|
||||
await queryRunner.manager.delete(ProfileSalary, {
|
||||
...(isOfficer ? { profileId: body.profileId } : { profileEmployeeId: body.profileId }),
|
||||
|
|
@ -1377,6 +1380,15 @@ export class ProfileSalaryTempController extends Controller {
|
|||
await queryRunner.manager.insert(ProfileSalary, insertData);
|
||||
}
|
||||
|
||||
// insert profile salary temp new
|
||||
if (backupTemp.length > 0) {
|
||||
const insertBackupTemp = toInsert.map(({ id, ...data }) => ({
|
||||
...data,
|
||||
}));
|
||||
|
||||
await queryRunner.manager.insert(ProfileSalaryTemp, insertBackupTemp);
|
||||
}
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue