From 5ac8da1057b3d3dd99128fae1e6f0598f20221a6 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 15 Nov 2024 13:48:24 +0700 Subject: [PATCH] update profile.amount & fix lock --- src/controllers/CommandController.ts | 4 ++-- src/controllers/ProfileSalaryController.ts | 5 +++++ src/controllers/ProfileSalaryEmployeeController.ts | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 1aca2425..19205d41 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -3590,8 +3590,8 @@ export class CommandController extends Controller { }); if ( orgRevision != null && - !["REPORT"].includes( - orgRevision.posMasters.find((x) => x.statusReport === "REPORT")?.statusReport || "", + !["REPORT", "DONE"].includes( + orgRevision.posMasters.find((x) => x.statusReport === "REPORT" || x.statusReport === "DONE")?.statusReport || "", ) ) { await this.orgRevisionRepo.update(orgRevision.id, { diff --git a/src/controllers/ProfileSalaryController.ts b/src/controllers/ProfileSalaryController.ts index 1134b6fb..2eb735bb 100644 --- a/src/controllers/ProfileSalaryController.ts +++ b/src/controllers/ProfileSalaryController.ts @@ -131,6 +131,11 @@ export class ProfileSalaryController extends Controller { history.profileSalaryId = data.id; await this.salaryHistoryRepo.save(history, { data: req }); + let null_:any = null; + profile.amount = body.amount ?? null_; + profile.positionSalaryAmount = body.positionSalaryAmount ?? null_; + profile.mouthSalaryAmount = body.mouthSalaryAmount ?? null_; + await this.profileRepo.save(profile); return new HttpSuccess(); } diff --git a/src/controllers/ProfileSalaryEmployeeController.ts b/src/controllers/ProfileSalaryEmployeeController.ts index 71763656..b0b19e2c 100644 --- a/src/controllers/ProfileSalaryEmployeeController.ts +++ b/src/controllers/ProfileSalaryEmployeeController.ts @@ -142,7 +142,12 @@ export class ProfileSalaryEmployeeController extends Controller { setLogDataDiff(req, { before, after: data }); history.profileSalaryId = data.id; await this.salaryHistoryRepo.save(history, { data: req }); - + + let null_:any = null; + profile.amount = body.amount ?? null_; + profile.positionSalaryAmount = body.positionSalaryAmount ?? null_; + profile.mouthSalaryAmount = body.mouthSalaryAmount ?? null_; + await this.profileRepo.save(profile); return new HttpSuccess(); }