diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index d58b847..c29ad9a 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -329,7 +329,7 @@ export class SalaryPeriodController extends Controller { salaryOrg.quantityUsed = amountFullType; const calRemainQuota = salaryOrg.fifteenPercent - amountFullType; salaryOrg.remainQuota = calRemainQuota; - await this.salaryOrgRepository.save(salaryOrg,{data:req}); + await this.salaryOrgRepository.save(salaryOrg, { data: req }); } } } else if (_salaryProfile.salaryOrg.salaryPeriod.period == "OCT") { @@ -383,7 +383,7 @@ export class SalaryPeriodController extends Controller { ? 0 : sumAmountUse.totalAmount; salaryOrg.remainingAmount = calRemainAmount; - await this.salaryOrgRepository.save(salaryOrg,{data:req}); + await this.salaryOrgRepository.save(salaryOrg, { data: req }); } } } @@ -579,7 +579,7 @@ export class SalaryPeriodController extends Controller { } else { throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง"); } - const before = null; + const before = structuredClone(salaryProfile); await this.salaryProfileRepository.save(salaryProfile, { data: request }); setLogDataDiff(request, { before, after: salaryProfile }); @@ -1026,7 +1026,7 @@ export class SalaryPeriodController extends Controller { } else { throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง"); } - const before = null; + const before = structuredClone(salaryProfile); await this.salaryProfileRepository.save(salaryProfile, { data: req }); setLogDataDiff(req, { before, after: salaryProfile }); @@ -3098,9 +3098,8 @@ export class SalaryPeriodController extends Controller { const before = structuredClone(x); x.status = "WAITHEAD2"; x.ownerRecommend = body.titleRecommend; - await this.salaryOrgRepository.save(x,{data:request}); + await this.salaryOrgRepository.save(x, { data: request }); setLogDataDiff(request, { before, after: x }); - }), ); return new HttpSuccess(); @@ -3138,9 +3137,8 @@ export class SalaryPeriodController extends Controller { const before = structuredClone(x); x.status = "REPORT"; x.ownerRecommend = body.titleRecommend; - await this.salaryOrgRepository.save(x,{data:request}); + await this.salaryOrgRepository.save(x, { data: request }); setLogDataDiff(request, { before, after: x }); - }), ); return new HttpSuccess(); diff --git a/src/controllers/SalaryPeriodEmployeeController.ts b/src/controllers/SalaryPeriodEmployeeController.ts index ca76961..d239826 100644 --- a/src/controllers/SalaryPeriodEmployeeController.ts +++ b/src/controllers/SalaryPeriodEmployeeController.ts @@ -713,7 +713,7 @@ export class SalaryPeriodEmployeeController extends Controller { throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง"); } - const before = null; + const before = structuredClone(salaryProfile); await this.salaryProfileRepository.save(salaryProfile, { data: req }); setLogDataDiff(req, { before, after: salaryProfile }); @@ -1334,7 +1334,7 @@ export class SalaryPeriodEmployeeController extends Controller { } else { throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง"); } - const before = null; + const before = structuredClone(salaryProfile); await this.salaryProfileRepository.save(salaryProfile, { data: req }); setLogDataDiff(req, { before, after: salaryProfile });