From fbda0293c7eecf03dec55f0d6e3b5a772df10e17 Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 19 Feb 2024 10:25:45 +0700 Subject: [PATCH] edit del && fields salaryRank --- src/controllers/SalaryController.ts | 4 ++++ src/entities/SalaryRanks.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/controllers/SalaryController.ts b/src/controllers/SalaryController.ts index f8522d1..2cbc612 100644 --- a/src/controllers/SalaryController.ts +++ b/src/controllers/SalaryController.ts @@ -211,6 +211,10 @@ export class Salary extends Controller { "ไม่สามารถลบไอดี: " + id + " ได้ เนื่องสถานะการใช้งานที่เป็น Default", ); } + const del_SalaryRank = await this.salaryRankRepository.find({ + where: { salaryId: chk_Salary.id } + }); + await this.salaryRankRepository.remove(del_SalaryRank); await this.salaryRepository.remove(chk_Salary); return new HttpSuccess(); } catch (error: any) { diff --git a/src/entities/SalaryRanks.ts b/src/entities/SalaryRanks.ts index a1a9c52..a703651 100644 --- a/src/entities/SalaryRanks.ts +++ b/src/entities/SalaryRanks.ts @@ -82,22 +82,22 @@ export class CreateSalaryRank { salary: number; @Column() - salaryHalf?: number; + salaryHalf?: number | null; @Column() - salaryHalfSpecial?: number; + salaryHalfSpecial?: number | null; @Column() - salaryFull?: number; + salaryFull?: number | null; @Column() - salaryFullSpecial?: number; + salaryFullSpecial?: number | null; @Column() - salaryFullHalf?: number; + salaryFullHalf?: number | null; @Column() - salaryFullHalfSpecial?: number; + salaryFullHalfSpecial?: number | null; @Column() isNext: boolean;