From a421f8d0f6ecfabf50a22508857821e6978e81fb Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:42:12 +0700 Subject: [PATCH 01/10] =?UTF-8?q?fix:=20=E0=B8=A5=E0=B8=9A=20isActive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/ProfileHonorHistory.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/entities/ProfileHonorHistory.ts b/src/entities/ProfileHonorHistory.ts index 4c4c5304..a4cea3dc 100644 --- a/src/entities/ProfileHonorHistory.ts +++ b/src/entities/ProfileHonorHistory.ts @@ -5,12 +5,6 @@ import { ProfileHonor } from "./ProfileHonor"; @Entity("profileHonorHistory") export class ProfileHonorHistory extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, length: 2000, @@ -72,9 +66,6 @@ export class ProfileHonorHistory extends EntityBase { } export class CreateProfileHonorHistory { - @Column() - isActive: boolean; - @Column() detail: string | null; From 04eb3e256460f39c71dc4da32309d8a5ccf1b88c Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:28:24 +0700 Subject: [PATCH 02/10] =?UTF-8?q?feat:=20=20=E0=B8=AA=E0=B8=A3=E0=B9=89?= =?UTF-8?q?=E0=B8=B2=E0=B8=87=20=20entities=20=20=20=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=A5=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/LeaveType.ts | 41 +++++ src/entities/ProfileLeave.ts | 286 +++-------------------------------- 2 files changed, 62 insertions(+), 265 deletions(-) create mode 100644 src/entities/LeaveType.ts diff --git a/src/entities/LeaveType.ts b/src/entities/LeaveType.ts new file mode 100644 index 00000000..cb839791 --- /dev/null +++ b/src/entities/LeaveType.ts @@ -0,0 +1,41 @@ +import { Entity, Column, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; + +import { ProfileLeave } from "./ProfileLeave"; + +@Entity("leaveType") +export class LeaveType extends EntityBase { + @Column({ + nullable: true, + comment: "ประเภทการลา", + length: 255, + default: null, + }) + name: string; + + @Column({ + nullable: true, + comment: "รหัสประเภอการลา", + length: 255, + default: null, + }) + code: number; + + @Column({ + nullable: true, + comment: "ลาได้สูงสุด(วัน)", + default: true, + }) + limit: number; + + @OneToMany(() => ProfileLeave, (v) => v.leaveType) + profileLeave: ProfileLeave; +} + +export class CreateBloodGroup { + name: string | null; + code: number | null; + limit: number | null; +} + +export type UpdateBloodGroup = Partial; diff --git a/src/entities/ProfileLeave.ts b/src/entities/ProfileLeave.ts index 2c448f35..918a3286 100644 --- a/src/entities/ProfileLeave.ts +++ b/src/entities/ProfileLeave.ts @@ -2,6 +2,7 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; import { ProfileLeaveHistory } from "./ProfileLeaveHistory"; +import { LeaveType } from "./LeaveType"; @Entity("profileLeave") export class ProfileLeave extends EntityBase { @@ -13,227 +14,37 @@ export class ProfileLeave extends EntityBase { }) profileId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, - type: "double", - comment: "", + length: 40, + comment: "คีย์นอก(FK)ของตาราง LeaveType", default: null, }) - restCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - restDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลาพักผ่อน (วัน)", - default: null, - }) - sickCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลาป่วย (วัน)", - default: null, - }) - sickDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - otherDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - personalCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลากิจส่วนตัว (วัน)", - default: null, - }) - personalDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - studyCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - absentCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล (วัน)", - default: null, - }) - absentDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - agencyCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลาไปปฏิบัติงานในองค์การระหว่างประเทศ (วัน)", - default: null, - }) - agencyDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - coupleCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลาติดตามคู่สมรส (วัน)", - default: null, - }) - coupleDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - lateCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - lateDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - maternityCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลาคลอดบุตร (วัน)", - default: null, - }) - maternityDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - militaryCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - militaryDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - ordainCount: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลาอุปสมบทหรือการลาประกอบพิธีฮัจย์ฯ (วัน)", - default: null, - }) - ordainDay: number; - - @Column({ - nullable: true, - type: "double", - comment: "", - default: null, - }) - otherCount: number; + leaveTypeId: string; @Column({ nullable: true, type: "datetime", - comment: "วัน เดือน ปี ที่เริ่มลา", + comment: "วัน เดือน ปี ที่ลา", default: null, }) - dateStartLeave: Date; - - @Column({ - nullable: true, - type: "datetime", - comment: "วัน เดือน ปี ที่สิ้นสุดลา", - default: null, - }) - dateEndLeave: Date; + dateLeave: Date; @Column({ nullable: true, type: "double", - comment: "ลาครั้งที่", + comment: "จำนวนวันลา", default: null, }) - numLeave: number; + leaveDays: number; @Column({ nullable: true, type: "double", - comment: "ลามาแล้ว", + comment: "ลามาเเล้ว", default: null, }) - sumLeave: number; + leverCount: number; @Column({ nullable: true, @@ -251,14 +62,6 @@ export class ProfileLeave extends EntityBase { }) status: string; - @Column({ - nullable: true, - length: 40, - comment: "คีย์นอก(FK)ของตาราง TypeLeave", - default: null, - }) - typeLeaveId: string; - @Column({ nullable: true, comment: "เหตุผล", @@ -270,6 +73,10 @@ export class ProfileLeave extends EntityBase { @OneToMany(() => ProfileLeaveHistory, (profileLeaveHistory) => profileLeaveHistory.histories) profileLeaves: ProfileLeaveHistory[]; + @ManyToOne(() => LeaveType, (leaveType) => leaveType.profileLeave) + @JoinColumn({ name: "leaveTypeId" }) + leaveType: LeaveType; + @ManyToOne(() => Profile, (profile) => profile.profileLeaves) @JoinColumn({ name: "profileId" }) profile: Profile; @@ -277,71 +84,20 @@ export class ProfileLeave extends EntityBase { export class CreateProfileLeave { profileId: string | null; - isActive: boolean; - restCount: number | null; - restDay: number | null; - sickCount: number | null; - sickDay: number | null; - otherDay: number | null; - personalCount: number | null; - personalDay: number | null; - studyCount: number | null; - absentCount: number | null; - absentDay: number | null; - agencyCount: number | null; - agencyDay: number | null; - coupleCount: number | null; - coupleDay: number | null; - lateCount: number | null; - lateDay: number | null; - maternityCount: number | null; - maternityDay: number | null; - militaryCount: number | null; - militaryDay: number | null; - ordainCount: number | null; - ordainDay: number | null; - otherCount: number | null; - dateStartLeave: Date | null; - dateEndLeave: Date | null; - numLeave: number | null; - sumLeave: number | null; + leaveTypeId: string | null; + dateLeave: Date | null; + leaveDays: number | null; + leverCount: number | null; totalLeave: number | null; status: string | null; - typeLeaveId: string | null; reason: string | null; } export type UpdateProfileLeave = { - isActive?: boolean; - restCount?: number | null; - restDay?: number | null; - sickCount?: number | null; - sickDay?: number | null; - otherDay?: number | null; - personalCount?: number | null; - personalDay?: number | null; - studyCount?: number | null; - absentCount?: number | null; - absentDay?: number | null; - agencyCount?: number | null; - agencyDay?: number | null; - coupleCount?: number | null; - coupleDay?: number | null; - lateCount?: number | null; - lateDay?: number | null; - maternityCount?: number | null; - maternityDay?: number | null; - militaryCount?: number | null; - militaryDay?: number | null; - ordainCount?: number | null; - ordainDay?: number | null; - otherCount?: number | null; - dateStartLeave?: Date | null; - dateEndLeave?: Date | null; - numLeave?: number | null; - sumLeave?: number | null; + dateLeave?: Date | null; + leaveDays?: number | null; + leverCount?: number | null; totalLeave?: number | null; status?: string | null; - typeLeaveId?: string | null; reason?: string | null; }; From 8e939b0d56419a15106dd296a714202730481ede Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:30:30 +0700 Subject: [PATCH 03/10] =?UTF-8?q?fix:=20=E0=B9=81=E0=B8=81=E0=B9=89?= =?UTF-8?q?=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=95=E0=B8=B1=E0=B8=A7?= =?UTF-8?q?=E0=B9=80=E0=B9=80=E0=B8=9B=E0=B8=A3=20LeaveType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/LeaveType.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/entities/LeaveType.ts b/src/entities/LeaveType.ts index cb839791..373dc2a6 100644 --- a/src/entities/LeaveType.ts +++ b/src/entities/LeaveType.ts @@ -32,10 +32,10 @@ export class LeaveType extends EntityBase { profileLeave: ProfileLeave; } -export class CreateBloodGroup { +export class CreateLeaveType { name: string | null; code: number | null; limit: number | null; } -export type UpdateBloodGroup = Partial; +export type UpdateLeaveType = Partial; From f769a0820c4953ce2185c1462f6b27cc83668bad Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:35:07 +0700 Subject: [PATCH 04/10] =?UTF-8?q?fix:=20=E0=B9=80=E0=B9=80=E0=B8=81?= =?UTF-8?q?=E0=B9=89=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=A7=E0=B9=80=E0=B9=80=E0=B8=9B=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/ProfileLeave.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/ProfileLeave.ts b/src/entities/ProfileLeave.ts index 918a3286..9380b028 100644 --- a/src/entities/ProfileLeave.ts +++ b/src/entities/ProfileLeave.ts @@ -44,7 +44,7 @@ export class ProfileLeave extends EntityBase { comment: "ลามาเเล้ว", default: null, }) - leverCount: number; + leaveCount: number; @Column({ nullable: true, From c20676af5dc9a00fdadaa5c14f97eeb045cb4552 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:38:13 +0700 Subject: [PATCH 05/10] fix: entity fields --- src/entities/LeaveType.ts | 11 +++++++---- src/entities/ProfileLeave.ts | 8 +++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/entities/LeaveType.ts b/src/entities/LeaveType.ts index 373dc2a6..86ae595c 100644 --- a/src/entities/LeaveType.ts +++ b/src/entities/LeaveType.ts @@ -16,10 +16,9 @@ export class LeaveType extends EntityBase { @Column({ nullable: true, comment: "รหัสประเภอการลา", - length: 255, default: null, }) - code: number; + code: string; @Column({ nullable: true, @@ -34,8 +33,12 @@ export class LeaveType extends EntityBase { export class CreateLeaveType { name: string | null; - code: number | null; + code: string | null; limit: number | null; } -export type UpdateLeaveType = Partial; +export type UpdateLeaveType = { + name?: string | null; + code?: string | null; + limit?: number | null; +}; diff --git a/src/entities/ProfileLeave.ts b/src/entities/ProfileLeave.ts index 9380b028..c9f060e3 100644 --- a/src/entities/ProfileLeave.ts +++ b/src/entities/ProfileLeave.ts @@ -70,15 +70,13 @@ export class ProfileLeave extends EntityBase { }) reason: string; - @OneToMany(() => ProfileLeaveHistory, (profileLeaveHistory) => profileLeaveHistory.histories) + @OneToMany(() => ProfileLeaveHistory, (v) => v.histories) profileLeaves: ProfileLeaveHistory[]; - @ManyToOne(() => LeaveType, (leaveType) => leaveType.profileLeave) - @JoinColumn({ name: "leaveTypeId" }) + @ManyToOne(() => LeaveType, (v) => v.profileLeave) leaveType: LeaveType; - @ManyToOne(() => Profile, (profile) => profile.profileLeaves) - @JoinColumn({ name: "profileId" }) + @ManyToOne(() => Profile, (v) => v.profileLeaves) profile: Profile; } From be2b08c3469a1fe541734b80c679a301a50dd5cd Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:13:42 +0700 Subject: [PATCH 06/10] =?UTF-8?q?feat=20=20=E0=B9=80=E0=B8=9E=E0=B8=B4?= =?UTF-8?q?=E0=B9=88=E0=B8=A1=20type=20=20Update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/ProfileLeave.ts | 1 + src/entities/ProfileLeaveHistory.ts | 367 +--------------------------- 2 files changed, 13 insertions(+), 355 deletions(-) diff --git a/src/entities/ProfileLeave.ts b/src/entities/ProfileLeave.ts index c9f060e3..89636da0 100644 --- a/src/entities/ProfileLeave.ts +++ b/src/entities/ProfileLeave.ts @@ -92,6 +92,7 @@ export class CreateProfileLeave { } export type UpdateProfileLeave = { + leaveTypeId?: string | null; dateLeave?: Date | null; leaveDays?: number | null; leverCount?: number | null; diff --git a/src/entities/ProfileLeaveHistory.ts b/src/entities/ProfileLeaveHistory.ts index d177f09e..1e43b4bd 100644 --- a/src/entities/ProfileLeaveHistory.ts +++ b/src/entities/ProfileLeaveHistory.ts @@ -1,264 +1,10 @@ import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; -import { ProfileLeave } from "./ProfileLeave"; +import { ProfileLeave, CreateProfileLeave, UpdateProfileLeave } from "./ProfileLeave"; @Entity("profileLeaveHistory") -export class ProfileLeaveHistory extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // restCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // restDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "ลาพักผ่อน (วัน)", - // default: null, - // }) - // sickCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "ลาป่วย (วัน)", - // default: null, - // }) - // sickDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // otherDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // personalCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "ลากิจส่วนตัว (วัน)", - // default: null, - // }) - // personalDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // studyCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // absentCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล (วัน)", - // default: null, - // }) - // absentDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // agencyCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "ลาไปปฏิบัติงานในองค์การระหว่างประเทศ (วัน)", - // default: null, - // }) - // agencyDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // coupleCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "ลาติดตามคู่สมรส (วัน)", - // default: null, - // }) - // coupleDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // lateCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // lateDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // maternityCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "ลาคลอดบุตร (วัน)", - // default: null, - // }) - // maternityDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // militaryCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // militaryDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // ordainCount: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "ลาอุปสมบทหรือการลาประกอบพิธีฮัจย์ฯ (วัน)", - // default: null, - // }) - // ordainDay: number; - - // @Column({ - // nullable: true, - // type: "double", - // comment: "", - // default: null, - // }) - // otherCount: number; - - @Column({ - nullable: true, - type: "datetime", - comment: "วัน เดือน ปี ที่เริ่มลา", - default: null, - }) - dateStartLeave: Date; - - @Column({ - nullable: true, - type: "datetime", - comment: "วัน เดือน ปี ที่สิ้นสุดลา", - default: null, - }) - dateEndLeave: Date; - - @Column({ - nullable: true, - type: "double", - comment: "ลาครั้งที่", - default: null, - }) - numLeave: number; - - @Column({ - nullable: true, - type: "double", - comment: "ลามาแล้ว", - default: null, - }) - sumLeave: number; - - @Column({ - nullable: true, - type: "double", - comment: "รวมเป็น", - default: null, - }) - totalLeave: number; - - @Column({ - nullable: true, - comment: "สถานะ", - type: "text", - default: null, - }) - status: string; - - @Column({ - nullable: true, - length: 40, - comment: "คีย์นอก(FK)ของตาราง TypeLeave", - default: null, - }) - typeLeaveId: string; - - @Column({ - nullable: true, - comment: "เหตุผล", - type: "text", - default: null, - }) - reason: string; - +export class ProfileLeaveHistory extends ProfileLeave { @Column({ nullable: true, length: 40, @@ -272,105 +18,16 @@ export class ProfileLeaveHistory extends EntityBase { histories: ProfileLeave; } -export class CreateProfileLeaveHistory { - @Column() - isActive: boolean; - - // @Column() - // restCount: number | null; - - // @Column() - // restDay: number | null; - - // @Column() - // sickCount: number | null; - - // @Column() - // sickDay: number | null; - - // @Column() - // otherDay: number | null; - - // @Column() - // personalCount: number | null; - - // @Column() - // personalDay: number | null; - - // @Column() - // studyCount: number | null; - - // @Column() - // absentCount: number | null; - - // @Column() - // absentDay: number | null; - - // @Column() - // agencyCount: number | null; - - // @Column() - // agencyDay: number | null; - - // @Column() - // coupleCount: number | null; - - // @Column() - // coupleDay: number | null; - - // @Column() - // lateCount: number | null; - - // @Column() - // lateDay: number | null; - - // @Column() - // maternityCount: number | null; - - // @Column() - // maternityDay: number | null; - - // @Column() - // militaryCount: number | null; - - // @Column() - // militaryDay: number | null; - - // @Column() - // ordainCount: number | null; - - // @Column() - // ordainDay: number | null; - - // @Column() - // otherCount: number | null; - - @Column() - dateStartLeave: Date | null; - - @Column() - dateEndLeave: Date | null; - - @Column() - numLeave: number | null; - - @Column() - sumLeave: number | null; - - @Column() - totalLeave: number | null; - - @Column() - status: string | null; - - @Column("uuid") - typeLeaveId: string | null; - - @Column() - reason: string | null; - - @Column("uuid") +export class CreateProfileLeaveHistory extends CreateProfileLeave { profileLeaveId: string | null; } -export type UpdateProfileLeaveHistory = Partial; +export type UpdateProfileLeaveHistory = { + leaveTypeId?: string | null; + dateLeave?: Date | null; + leaveDays?: number | null; + leverCount?: number | null; + totalLeave?: number | null; + status?: string | null; + reason?: string | null; +}; From 2b24e4352276924c498b945786af9b03bb18bdf6 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:27:00 +0700 Subject: [PATCH 07/10] fix: profile leave entity --- src/entities/ProfileLeave.ts | 19 ++++++++++++++--- src/entities/ProfileLeaveHistory.ts | 33 ----------------------------- 2 files changed, 16 insertions(+), 36 deletions(-) delete mode 100644 src/entities/ProfileLeaveHistory.ts diff --git a/src/entities/ProfileLeave.ts b/src/entities/ProfileLeave.ts index 89636da0..6192f3e8 100644 --- a/src/entities/ProfileLeave.ts +++ b/src/entities/ProfileLeave.ts @@ -1,7 +1,6 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; -import { ProfileLeaveHistory } from "./ProfileLeaveHistory"; import { LeaveType } from "./LeaveType"; @Entity("profileLeave") @@ -70,8 +69,8 @@ export class ProfileLeave extends EntityBase { }) reason: string; - @OneToMany(() => ProfileLeaveHistory, (v) => v.histories) - profileLeaves: ProfileLeaveHistory[]; + @OneToMany(() => ProfileLeaveHistory, (v) => v.profileLeave) + histories: ProfileLeaveHistory[]; @ManyToOne(() => LeaveType, (v) => v.profileLeave) leaveType: LeaveType; @@ -80,6 +79,20 @@ export class ProfileLeave extends EntityBase { profile: Profile; } +@Entity("profileLeaveHistory") +export class ProfileLeaveHistory extends ProfileLeave { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileLeave", + default: null, + }) + profileLeaveId: string; + + @ManyToOne(() => ProfileLeave, (v) => v.histories) + profileLeave: ProfileLeave; +} + export class CreateProfileLeave { profileId: string | null; leaveTypeId: string | null; diff --git a/src/entities/ProfileLeaveHistory.ts b/src/entities/ProfileLeaveHistory.ts deleted file mode 100644 index 1e43b4bd..00000000 --- a/src/entities/ProfileLeaveHistory.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; -import { EntityBase } from "./base/Base"; -import { Profile } from "./Profile"; -import { ProfileLeave, CreateProfileLeave, UpdateProfileLeave } from "./ProfileLeave"; - -@Entity("profileLeaveHistory") -export class ProfileLeaveHistory extends ProfileLeave { - @Column({ - nullable: true, - length: 40, - comment: "คีย์นอก(FK)ของตาราง ProfileLeave", - default: null, - }) - profileLeaveId: string; - - @ManyToOne(() => ProfileLeave, (profileLeave) => profileLeave.profileLeaves) - @JoinColumn({ name: "profileLeaveId" }) - histories: ProfileLeave; -} - -export class CreateProfileLeaveHistory extends CreateProfileLeave { - profileLeaveId: string | null; -} - -export type UpdateProfileLeaveHistory = { - leaveTypeId?: string | null; - dateLeave?: Date | null; - leaveDays?: number | null; - leverCount?: number | null; - totalLeave?: number | null; - status?: string | null; - reason?: string | null; -}; From c13ca10a3e95755ab00429afa5a6ef5da981b284 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:59:05 +0700 Subject: [PATCH 08/10] feat: CRUD leave --- src/controllers/ProfileLeaveController.ts | 112 ++++++++++++++++++++-- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/src/controllers/ProfileLeaveController.ts b/src/controllers/ProfileLeaveController.ts index 85ab7fb9..9534a71e 100644 --- a/src/controllers/ProfileLeaveController.ts +++ b/src/controllers/ProfileLeaveController.ts @@ -13,11 +13,16 @@ import { Tags, } from "tsoa"; import { AppDataSource } from "../database/data-source"; -import { CreateProfileLeave, ProfileLeave, UpdateProfileLeave } from "../entities/ProfileLeave"; +import { + ProfileLeaveHistory, + CreateProfileLeave, + ProfileLeave, + UpdateProfileLeave, +} from "../entities/ProfileLeave"; import HttpSuccess from "../interfaces/http-success"; import HttpStatus from "../interfaces/http-status"; import HttpError from "../interfaces/http-error"; -import { ProfileLeaveHistory } from "../entities/ProfileLeaveHistory"; + import { RequestWithUser } from "../middlewares/user"; import { Profile } from "../entities/Profile"; @@ -33,10 +38,41 @@ export class ProfileLeaveController extends Controller { @Example({ status: 200, message: "สำเร็จ", - result: [], + result: { + id: "adbb08a6-d2f4-41b0-a9c1-49e883ca96bc", + createdAt: "2024-03-20T23:35:45.230Z", + createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + lastUpdatedAt: "2024-03-20T23:40:06.000Z", + lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + createdFullName: "สาวิตรี ศรีสมัย", + lastUpdateFullName: "สาวิตรี ศรีสมัย", + profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", + leaveTypeId: "8dc5e672-b416-4323-b086-06dde8c4353c", + dateLeave: "2024-03-21T06:39:46.000Z", + leaveDays: 0, + leaveCount: null, + totalLeave: 0, + status: "string", + reason: "string", + leaveType: { + id: "8dc5e672-b416-4323-b086-06dde8c4353c", + createdAt: "2024-02-04T21:28:40.536Z", + createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + lastUpdatedAt: "2024-02-04T21:28:40.536Z", + lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + createdFullName: "สาวิตรี ศรีสมัย", + lastUpdateFullName: "สาวิตรี ศรีสมัย", + name: "ลาป่วย", + code: "CM-002", + limit: 1, + }, + }, }) public async getLeave(@Path() profileId: string) { - const record = await this.leaveRepo.findBy({ profileId }); + const record = await this.leaveRepo.findOne({ + relations: { leaveType: true }, + where: { profileId }, + }); return new HttpSuccess(record); } @@ -44,11 +80,73 @@ export class ProfileLeaveController extends Controller { @Example({ status: 200, message: "สำเร็จ", - result: [], + result: [ + { + id: "7eed2e72-d71c-4b3b-a90b-e1b7abdaa838", + createdAt: "2024-03-20T23:35:45.230Z", + createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + lastUpdatedAt: "2024-03-20T23:40:06.000Z", + lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + createdFullName: "สาวิตรี ศรีสมัย", + lastUpdateFullName: "สาวิตรี ศรีสมัย", + profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", + leaveTypeId: "8dc5e672-b416-4323-b086-06dde8c4353c", + dateLeave: "2024-03-21T06:39:46.000Z", + leaveDays: 0, + leaveCount: null, + totalLeave: 0, + status: "string", + reason: "string", + leaveType: { + id: "8dc5e672-b416-4323-b086-06dde8c4353c", + createdAt: "2024-02-04T21:28:40.536Z", + createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + lastUpdatedAt: "2024-02-04T21:28:40.536Z", + lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + createdFullName: "สาวิตรี ศรีสมัย", + lastUpdateFullName: "สาวิตรี ศรีสมัย", + name: "ลาป่วย", + code: "CM-002", + limit: 1, + }, + profileLeaveId: "adbb08a6-d2f4-41b0-a9c1-49e883ca96bc", + }, + { + id: "b1b9c291-9c96-4cbb-9309-6ff5a2a6e0e8", + createdAt: "2024-03-20T23:35:45.230Z", + createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + lastUpdatedAt: "2024-03-20T23:35:45.230Z", + lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + createdFullName: "สาวิตรี ศรีสมัย", + lastUpdateFullName: "สาวิตรี ศรีสมัย", + profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", + leaveTypeId: "7dc4e314-b456-4323-b086-06dde8c4353c", + dateLeave: "2024-03-21T06:34:49.000Z", + leaveDays: 2, + leaveCount: null, + totalLeave: 200, + status: "ไม่ผ่าน", + reason: "ติดงานสำคัญ", + leaveType: { + id: "7dc4e314-b456-4323-b086-06dde8c4353c", + createdAt: "2024-02-04T21:28:40.536Z", + createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + lastUpdatedAt: "2024-02-04T21:28:40.536Z", + lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", + createdFullName: "สาวิตรี ศรีสมัย", + lastUpdateFullName: "สาวิตรี ศรีสมัย", + name: "ลาพักร้อน", + code: "CM-001", + limit: 356, + }, + profileLeaveId: "adbb08a6-d2f4-41b0-a9c1-49e883ca96bc", + }, + ], }) public async leaveHistory(@Path() leaveId: string) { - const record = await this.leaveHistoryRepo.findBy({ - profileLeaveId: leaveId, + const record = await this.leaveHistoryRepo.find({ + relations: { leaveType: true }, + where: { profileLeaveId: leaveId }, }); return new HttpSuccess(record); } From 23f8382928f814235d23090d68fb834299c4f010 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 21 Mar 2024 14:11:53 +0700 Subject: [PATCH 09/10] =?UTF-8?q?fix:=20=E0=B8=A5=E0=B8=9A=20isActive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/ProfileAbility.ts | 8 ------- src/entities/ProfileAbilityHistory.ts | 6 ------ src/entities/ProfileCertificate.ts | 18 ++++++---------- src/entities/ProfileCertificateHistory.ts | 26 +++++++---------------- src/entities/ProfileChangeName.ts | 21 +++++++----------- src/entities/ProfileChangeNameHistory.ts | 15 ++++--------- src/entities/ProfileDiscipline.ts | 10 ++------- src/entities/ProfileDisciplineHistory.ts | 13 +++++------- src/entities/ProfileDuty.ts | 9 +------- src/entities/ProfileDutyHistory.ts | 6 ------ src/entities/ProfileEducation.ts | 9 +------- src/entities/ProfileEducationHistory.ts | 9 -------- src/entities/ProfileFamily.ts | 16 -------------- src/entities/ProfileGovernment.ts | 8 ------- src/entities/ProfileInsignia.ts | 6 ------ src/entities/ProfileInsigniaHistory.ts | 6 ------ src/entities/ProfileNopaid.ts | 9 +------- src/entities/ProfileNopaidHistory.ts | 6 ------ 18 files changed, 36 insertions(+), 165 deletions(-) diff --git a/src/entities/ProfileAbility.ts b/src/entities/ProfileAbility.ts index b661cd2b..dfdc7206 100644 --- a/src/entities/ProfileAbility.ts +++ b/src/entities/ProfileAbility.ts @@ -13,12 +13,6 @@ export class ProfileAbility extends EntityBase { }) profileId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, comment: "หมายเหตุ", @@ -80,7 +74,6 @@ export class ProfileAbility extends EntityBase { export class CreateProfileAbility { profileId: string | null; - isActive: boolean; remark: string | null; detail: string | null; reference: string | null; @@ -90,7 +83,6 @@ export class CreateProfileAbility { } export type UpdateProfileAbility = { - isActive?: boolean; remark?: string | null; detail?: string | null; reference?: string | null; diff --git a/src/entities/ProfileAbilityHistory.ts b/src/entities/ProfileAbilityHistory.ts index 04974946..17f05d2e 100644 --- a/src/entities/ProfileAbilityHistory.ts +++ b/src/entities/ProfileAbilityHistory.ts @@ -5,12 +5,6 @@ import { ProfileAbility } from "./ProfileAbility"; @Entity("profileAbilityHistory") export class ProfileAbilityHistory extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, comment: "หมายเหตุ", diff --git a/src/entities/ProfileCertificate.ts b/src/entities/ProfileCertificate.ts index 078a446a..6efbceac 100644 --- a/src/entities/ProfileCertificate.ts +++ b/src/entities/ProfileCertificate.ts @@ -21,12 +21,6 @@ export class ProfileCertificate extends EntityBase { }) expireDate: Date; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, type: "datetime", @@ -34,7 +28,7 @@ export class ProfileCertificate extends EntityBase { default: null, }) issueDate: Date; - + @Column({ nullable: true, comment: "เลขที่ใบอนุญาต", @@ -50,7 +44,7 @@ export class ProfileCertificate extends EntityBase { default: null, }) certificateType: string; - + @Column({ nullable: true, comment: "หน่วยงานผู้ออกใบอนุญาต", @@ -59,19 +53,20 @@ export class ProfileCertificate extends EntityBase { }) issuer: string; - @OneToMany(() => ProfileCertificateHistory, (profileCertificateHistory) => profileCertificateHistory.histories) + @OneToMany( + () => ProfileCertificateHistory, + (profileCertificateHistory) => profileCertificateHistory.histories, + ) profileCertificateHistories: ProfileCertificateHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileCertificates) @JoinColumn({ name: "profileId" }) profile: Profile; - } export class CreateProfileCertificate { profileId: string | null; expireDate: Date | null; - isActive: boolean; issueDate: Date | null; certificateNo: string | null; certificateType: string | null; @@ -80,7 +75,6 @@ export class CreateProfileCertificate { export type UpdateProfileCertificate = { expireDate?: Date | null; - isActive?: boolean; issueDate?: Date | null; certificateNo?: string | null; certificateType?: string | null; diff --git a/src/entities/ProfileCertificateHistory.ts b/src/entities/ProfileCertificateHistory.ts index 6ad1eb6f..eee63916 100644 --- a/src/entities/ProfileCertificateHistory.ts +++ b/src/entities/ProfileCertificateHistory.ts @@ -5,7 +5,6 @@ import { ProfileCertificate } from "./ProfileCertificate"; @Entity("profileCertificateHistory") export class ProfileCertificateHistory extends EntityBase { - @Column({ nullable: true, type: "datetime", @@ -14,12 +13,6 @@ export class ProfileCertificateHistory extends EntityBase { }) expireDate: Date; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, type: "datetime", @@ -27,7 +20,7 @@ export class ProfileCertificateHistory extends EntityBase { default: null, }) issueDate: Date; - + @Column({ nullable: true, comment: "เลขที่ใบอนุญาต", @@ -43,7 +36,7 @@ export class ProfileCertificateHistory extends EntityBase { default: null, }) certificateType: string; - + @Column({ nullable: true, comment: "หน่วยงานผู้ออกใบอนุญาต", @@ -60,35 +53,32 @@ export class ProfileCertificateHistory extends EntityBase { }) profileCertificateId: string; - @ManyToOne(() => ProfileCertificate, (profileCertificate) => profileCertificate.profileCertificateHistories) + @ManyToOne( + () => ProfileCertificate, + (profileCertificate) => profileCertificate.profileCertificateHistories, + ) @JoinColumn({ name: "profileCertificateId" }) histories: ProfileCertificate; - } export class CreateProfileCertificateHistory { - @Column() expireDate: Date | null; - @Column() - isActive: boolean; - @Column() issueDate: Date | null; - + @Column() certificateNo: string | null; @Column() certificateType: string | null; - + @Column() issuer: string | null; @Column("uuid") profileCertificateId: string | null; - } export type UpdateProfileCertificateHistory = Partial; diff --git a/src/entities/ProfileChangeName.ts b/src/entities/ProfileChangeName.ts index 0323c044..cfd9cf16 100644 --- a/src/entities/ProfileChangeName.ts +++ b/src/entities/ProfileChangeName.ts @@ -14,12 +14,6 @@ export class ProfileChangeName extends EntityBase { }) profileId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, length: 40, @@ -68,17 +62,19 @@ export class ProfileChangeName extends EntityBase { }) documentId: string; - @OneToMany(() => ProfileChangeNameHistory, (profileChangeNameHistory) => profileChangeNameHistory.histories) - profileChangeNameHistories: ProfileChangeNameHistory[]; + @OneToMany( + () => ProfileChangeNameHistory, + (profileChangeNameHistory) => profileChangeNameHistory.histories, + ) + profileChangeNameHistories: ProfileChangeNameHistory[]; - // @ManyToOne(() => Profile, (profile) => profile.profileChangeName) - // @JoinColumn({ name: "profileId" }) - // profile: Profile; + // @ManyToOne(() => Profile, (profile) => profile.profileChangeName) + // @JoinColumn({ name: "profileId" }) + // profile: Profile; } export class CreateProfileChangeName { profileId: string | null; - isActive: boolean; prefixId: string | null; prefix: string | null; firstName: string | null; @@ -88,7 +84,6 @@ export class CreateProfileChangeName { } export type UpdateProfileChangeName = { - isActive?: boolean; prefixId?: string | null; prefix?: string | null; firstName?: string | null; diff --git a/src/entities/ProfileChangeNameHistory.ts b/src/entities/ProfileChangeNameHistory.ts index 1af5bcb1..d9f1489f 100644 --- a/src/entities/ProfileChangeNameHistory.ts +++ b/src/entities/ProfileChangeNameHistory.ts @@ -5,13 +5,6 @@ import { ProfileChangeName } from "./ProfileChangeName"; @Entity("profileChangeNameHistory") export class ProfileChangeNameHistory extends EntityBase { - - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, length: 40, @@ -68,15 +61,16 @@ export class ProfileChangeNameHistory extends EntityBase { }) profileChangeNameId: string; - @ManyToOne(() => ProfileChangeName, (profileChangeName) => profileChangeName.profileChangeNameHistories) + @ManyToOne( + () => ProfileChangeName, + (profileChangeName) => profileChangeName.profileChangeNameHistories, + ) @JoinColumn({ name: "profileChangeNameId" }) histories: ProfileChangeName; - } export class CreateProfileChangeNameHistory { profileChangeNameId: string | null; - isActive: boolean; prefixId: string | null; prefix: string | null; firstName: string | null; @@ -87,7 +81,6 @@ export class CreateProfileChangeNameHistory { export type UpdateProfileChangeNameHistory = { profileChangeNameId?: string | null; - isActive?: boolean; prefixId?: string | null; prefix?: string | null; firstName?: string | null; diff --git a/src/entities/ProfileDiscipline.ts b/src/entities/ProfileDiscipline.ts index 8feee9aa..d30c82e5 100644 --- a/src/entities/ProfileDiscipline.ts +++ b/src/entities/ProfileDiscipline.ts @@ -20,12 +20,6 @@ export class ProfileDiscipline extends EntityBase { }) profileId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, comment: "ระดับความผิด", @@ -80,7 +74,7 @@ export class ProfileDiscipline extends EntityBase { export class CreateProfileDiscipline { date: Date | null; profileId: string; - isActive: boolean | null; + level: string | null; detail: string | null; refCommandDate: Date | null; @@ -90,7 +84,7 @@ export class CreateProfileDiscipline { export type UpdateProfileDiscipline = { date?: Date | null; - isActive?: boolean | null; + level?: string | null; detail?: string | null; refCommandDate?: Date | null; diff --git a/src/entities/ProfileDisciplineHistory.ts b/src/entities/ProfileDisciplineHistory.ts index 62d9131c..afafed17 100644 --- a/src/entities/ProfileDisciplineHistory.ts +++ b/src/entities/ProfileDisciplineHistory.ts @@ -20,12 +20,6 @@ export class ProfileDisciplineHistory extends EntityBase { }) profileDisciplineId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, comment: "ระดับความผิด", @@ -41,7 +35,7 @@ export class ProfileDisciplineHistory extends EntityBase { default: null, }) detail: string; - + @Column({ nullable: true, type: "datetime", @@ -66,7 +60,10 @@ export class ProfileDisciplineHistory extends EntityBase { }) unStigma: string; - @ManyToOne(() => ProfileDiscipline, (profileDiscipline) => profileDiscipline.profileDisciplineHistories) + @ManyToOne( + () => ProfileDiscipline, + (profileDiscipline) => profileDiscipline.profileDisciplineHistories, + ) @JoinColumn({ name: "profileDisciplineId" }) histories: ProfileDiscipline; } diff --git a/src/entities/ProfileDuty.ts b/src/entities/ProfileDuty.ts index fb031173..650b5f96 100644 --- a/src/entities/ProfileDuty.ts +++ b/src/entities/ProfileDuty.ts @@ -13,12 +13,6 @@ export class ProfileDuty extends EntityBase { }) profileId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, type: "datetime", @@ -77,7 +71,7 @@ export class ProfileDuty extends EntityBase { export class CreateProfileDuty { profileId: string | null; - isActive: boolean; + dateStart: Date | null; dateEnd: Date | null; detail: string | null; @@ -87,7 +81,6 @@ export class CreateProfileDuty { } export type UpdateProfileDuty = { - isActive?: boolean; dateStart?: Date | null; dateEnd?: Date | null; detail?: string | null; diff --git a/src/entities/ProfileDutyHistory.ts b/src/entities/ProfileDutyHistory.ts index 989cefba..af470777 100644 --- a/src/entities/ProfileDutyHistory.ts +++ b/src/entities/ProfileDutyHistory.ts @@ -5,12 +5,6 @@ import { ProfileDuty } from "./ProfileDuty"; @Entity("profileDutyHistory") export class ProfileDutyHistory extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, type: "datetime", diff --git a/src/entities/ProfileEducation.ts b/src/entities/ProfileEducation.ts index eb45ed7b..c69d08a2 100644 --- a/src/entities/ProfileEducation.ts +++ b/src/entities/ProfileEducation.ts @@ -13,12 +13,6 @@ export class ProfileEducation extends EntityBase { }) profileId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, comment: "ประเทศ", @@ -178,7 +172,7 @@ export class ProfileEducation extends EntityBase { export class CreateProfileEducation { profileId: string | null; - isActive: boolean; + country: string | null; degree: string | null; duration: string | null; @@ -201,7 +195,6 @@ export class CreateProfileEducation { } export type UpdateProfileEducation = { - isActive?: boolean; country?: string | null; degree?: string | null; duration?: string | null; diff --git a/src/entities/ProfileEducationHistory.ts b/src/entities/ProfileEducationHistory.ts index 3454130c..f8fcf8aa 100644 --- a/src/entities/ProfileEducationHistory.ts +++ b/src/entities/ProfileEducationHistory.ts @@ -5,12 +5,6 @@ import { ProfileEducation } from "./ProfileEducation"; @Entity("profileEducationHistory") export class ProfileEducationHistory extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, comment: "ประเทศ", @@ -174,9 +168,6 @@ export class ProfileEducationHistory extends EntityBase { } export class CreateProfileEducationHistory { - @Column() - isActive: boolean; - @Column() country: string | null; diff --git a/src/entities/ProfileFamily.ts b/src/entities/ProfileFamily.ts index c939534a..21cc1351 100644 --- a/src/entities/ProfileFamily.ts +++ b/src/entities/ProfileFamily.ts @@ -4,12 +4,6 @@ import { Profile } from "./Profile"; @Entity("profileFamilyHistory") export class ProfileFamilyHistory extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, default: null, @@ -170,12 +164,6 @@ export class ProfileFamilyHistory extends EntityBase { @Entity("profileChildren") export class ProfileChildren extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, default: null, @@ -262,7 +250,6 @@ export class ProfileChildrenHistory extends ProfileChildren { } export type CreateChildren = { - isActive: boolean; childrenCareer: string; childrenFirstName: string; childrenLastName: string; @@ -273,7 +260,6 @@ export type CreateChildren = { export type UpdateChildren = { id: string; - isActive?: boolean | null; childrenCareer?: string | null; childrenFirstName?: string | null; childrenLastName?: string | null; @@ -283,7 +269,6 @@ export type UpdateChildren = { }; export type CreateProfileFamily = { - isActive: boolean | null; couple: boolean | null; couplePrefix: string | null; coupleFirstName: string | null; @@ -310,7 +295,6 @@ export type CreateProfileFamily = { export type UpdateProfileFamily = { id: string; - isActive?: boolean | null; couple?: boolean | null; couplePrefix?: string | null; coupleFirstName?: string | null; diff --git a/src/entities/ProfileGovernment.ts b/src/entities/ProfileGovernment.ts index b9082567..41b86b34 100644 --- a/src/entities/ProfileGovernment.ts +++ b/src/entities/ProfileGovernment.ts @@ -4,12 +4,6 @@ import { Profile } from "./Profile"; @Entity("profileGovernment") export class ProfileGovernment extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, length: 40, @@ -172,7 +166,6 @@ export class ProfileGovernment extends EntityBase { positionEmployeePositionSide: string; } export type CreateProfileGovernment = { - isActive: boolean | null; positionId: string | null; profileId: string | null; profile: Profile | null; @@ -199,7 +192,6 @@ export type CreateProfileGovernment = { }; export type UpdateProfileGovernment = { - isActive?: boolean | null; positionId?: string | null; profile?: Profile | null; posNoId?: string | null; diff --git a/src/entities/ProfileInsignia.ts b/src/entities/ProfileInsignia.ts index 183930c0..623753f5 100644 --- a/src/entities/ProfileInsignia.ts +++ b/src/entities/ProfileInsignia.ts @@ -14,12 +14,6 @@ export class ProfileInsignia extends EntityBase { }) profileId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ comment: "ปีที่ยื่นขอ", }) diff --git a/src/entities/ProfileInsigniaHistory.ts b/src/entities/ProfileInsigniaHistory.ts index 5e8584aa..b5aa3d5e 100644 --- a/src/entities/ProfileInsigniaHistory.ts +++ b/src/entities/ProfileInsigniaHistory.ts @@ -5,12 +5,6 @@ import { Insignia } from "./Insignia"; @Entity("profileInsigniaHistory") export class ProfileInsigniaHistory extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ comment: "ปีที่ยื่นขอ" }) year: number; diff --git a/src/entities/ProfileNopaid.ts b/src/entities/ProfileNopaid.ts index 9a429e89..fd2092ae 100644 --- a/src/entities/ProfileNopaid.ts +++ b/src/entities/ProfileNopaid.ts @@ -13,12 +13,6 @@ export class ProfileNopaid extends EntityBase { }) profileId: string; - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, type: "datetime", @@ -69,7 +63,7 @@ export class ProfileNopaid extends EntityBase { export class CreateProfileNopaid { profileId: string | null; - isActive: boolean; + date: Date | null; detail: string | null; reference: string | null; @@ -78,7 +72,6 @@ export class CreateProfileNopaid { } export type UpdateProfileNopaid = { - isActive?: boolean; date?: Date | null; detail?: string | null; reference?: string | null; diff --git a/src/entities/ProfileNopaidHistory.ts b/src/entities/ProfileNopaidHistory.ts index e8f4cf71..a995d4c6 100644 --- a/src/entities/ProfileNopaidHistory.ts +++ b/src/entities/ProfileNopaidHistory.ts @@ -5,12 +5,6 @@ import { ProfileNopaid } from "./ProfileNopaid"; @Entity("profileNopaidHistory") export class ProfileNopaidHistory extends EntityBase { - @Column({ - comment: "สถานะการใช้งาน", - default: false, - }) - isActive: boolean; - @Column({ nullable: true, type: "datetime", From ed9ed493f57a0fe7d13bf6e0daf85736d0f4b07f Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 21 Mar 2024 14:19:42 +0700 Subject: [PATCH 10/10] =?UTF-8?q?fix:=20=E0=B8=A5=E0=B8=9A=20=20isActive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileAbilityController.ts | 3 --- .../ProfileAssessmentsController.ts | 3 --- .../ProfileCertificateController.ts | 3 --- .../ProfileChangeNameController.ts | 16 ++--------- .../ProfileDisciplineController.ts | 27 +++---------------- src/controllers/ProfileDutyController.ts | 5 ---- .../ProfileFamilyHistoryController.ts | 6 ----- src/controllers/ProfileHonorController.ts | 3 --- src/controllers/ProfileInsigniaController.ts | 3 --- src/controllers/ProfileNopaidController.ts | 3 --- 10 files changed, 5 insertions(+), 67 deletions(-) diff --git a/src/controllers/ProfileAbilityController.ts b/src/controllers/ProfileAbilityController.ts index df6fdd0c..161f8ae8 100644 --- a/src/controllers/ProfileAbilityController.ts +++ b/src/controllers/ProfileAbilityController.ts @@ -47,7 +47,6 @@ export class ProfileAbilityController extends Controller { createdFullName: "test bar", lastUpdateFullName: "test bar", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", - isActive: true, remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม", detail: "-", reference: "-", @@ -78,7 +77,6 @@ export class ProfileAbilityController extends Controller { lastUpdateUserId: "00000000-0000-0000-0000-000000000000", createdFullName: "string", lastUpdateFullName: "test bar", - isActive: true, remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม", detail: "ด่วน", reference: "-", @@ -95,7 +93,6 @@ export class ProfileAbilityController extends Controller { lastUpdateUserId: "00000000-0000-0000-0000-000000000000", createdFullName: "string", lastUpdateFullName: "test bar", - isActive: true, remark: "ต้องส่งให้ทันก่อนวันที่ 15 มีนาคม", detail: "ด่วนมากสุด", reference: "-", diff --git a/src/controllers/ProfileAssessmentsController.ts b/src/controllers/ProfileAssessmentsController.ts index 992770c8..e261083c 100644 --- a/src/controllers/ProfileAssessmentsController.ts +++ b/src/controllers/ProfileAssessmentsController.ts @@ -53,7 +53,6 @@ export class ProfileAssessmentsController extends Controller { createdFullName: "test bar", lastUpdateFullName: "test bar", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", - isActive: true, name: "สาวิตรี ศรีสมัย", date: "2024-03-13T03:55:42.000Z", point1: 0, @@ -86,7 +85,6 @@ export class ProfileAssessmentsController extends Controller { lastUpdateUserId: "00000000-0000-0000-0000-000000000000", createdFullName: "string", lastUpdateFullName: "test bar", - isActive: true, name: "สาวิตรี ศรีสมัย", date: "2024-03-13T03:55:42.000Z", point1: 0, @@ -105,7 +103,6 @@ export class ProfileAssessmentsController extends Controller { lastUpdateUserId: "00000000-0000-0000-0000-000000000000", createdFullName: "string", lastUpdateFullName: "test bar", - isActive: true, name: "สาวิตรี ศรีสมัย", date: "2024-03-13T03:55:42.000Z", point1: 50, diff --git a/src/controllers/ProfileCertificateController.ts b/src/controllers/ProfileCertificateController.ts index 567dbed2..c21d8db0 100644 --- a/src/controllers/ProfileCertificateController.ts +++ b/src/controllers/ProfileCertificateController.ts @@ -48,7 +48,6 @@ export class ProfileCertificateController extends Controller { lastUpdateFullName: "สาวิตรี ศรีสมัย", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", expireDate: "2024-03-12T10:01:48.000Z", - isActive: true, issueDate: "2024-03-12T10:01:48.000Z", certificateNo: "string", certificateType: "string", @@ -75,7 +74,6 @@ export class ProfileCertificateController extends Controller { createdFullName: "string", lastUpdateFullName: "สาวิตรี ศรีสมัย", expireDate: "2024-03-12T10:03:05.000Z", - isActive: true, issueDate: "2024-03-12T10:03:05.000Z", certificateNo: "no", certificateType: "type", @@ -91,7 +89,6 @@ export class ProfileCertificateController extends Controller { createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", expireDate: "2024-03-12T10:01:48.000Z", - isActive: true, issueDate: "2024-03-12T10:01:48.000Z", certificateNo: "string", certificateType: "string", diff --git a/src/controllers/ProfileChangeNameController.ts b/src/controllers/ProfileChangeNameController.ts index ba79109a..7cbad6cb 100644 --- a/src/controllers/ProfileChangeNameController.ts +++ b/src/controllers/ProfileChangeNameController.ts @@ -40,7 +40,6 @@ export class ProfileChangeNameController extends Controller { result: [ { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, prefix: "string", firstName: "string", lastName: "string", @@ -51,7 +50,7 @@ export class ProfileChangeNameController extends Controller { public async getChangeName(@Path() profileId: string) { const lists = await this.changeNameRepository.find({ where: { profileId: profileId }, - select: ["id", "isActive", "prefix", "firstName", "lastName", "status"], + select: ["id", "prefix", "firstName", "lastName", "status"], }); return new HttpSuccess(lists); } @@ -63,7 +62,6 @@ export class ProfileChangeNameController extends Controller { result: [ { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, prefix: "string", firstName: "string", lastName: "string", @@ -73,7 +71,6 @@ export class ProfileChangeNameController extends Controller { }, { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, prefix: "string", firstName: "string", lastName: "string", @@ -86,16 +83,7 @@ export class ProfileChangeNameController extends Controller { public async changeNameHistory(@Path() changeNameId: string) { const record = await this.changeNameHistoryRepository.find({ where: { profileChangeNameId: changeNameId }, - select: [ - "id", - "isActive", - "prefix", - "firstName", - "lastName", - "status", - "createdFullName", - "createdAt", - ], + select: ["id", "prefix", "firstName", "lastName", "status", "createdFullName", "createdAt"], order: { createdAt: "DESC" }, }); return new HttpSuccess(record); diff --git a/src/controllers/ProfileDisciplineController.ts b/src/controllers/ProfileDisciplineController.ts index 9a36c40c..6f904056 100644 --- a/src/controllers/ProfileDisciplineController.ts +++ b/src/controllers/ProfileDisciplineController.ts @@ -40,7 +40,6 @@ export class ProfileDisciplineController extends Controller { result: [ { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, date: "2024-03-12T10:09:47.000Z", level: "string", detail: "string", @@ -53,16 +52,7 @@ export class ProfileDisciplineController extends Controller { public async getDiscipline(@Path() profileId: string) { const lists = await this.disciplineRepository.find({ where: { profileId: profileId }, - select: [ - "id", - "isActive", - "date", - "level", - "detail", - "unStigma", - "refCommandNo", - "refCommandDate", - ], + select: ["id", "date", "level", "detail", "unStigma", "refCommandNo", "refCommandDate"], }); return new HttpSuccess(lists); } @@ -74,7 +64,6 @@ export class ProfileDisciplineController extends Controller { result: [ { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, date: "2024-03-12T10:09:47.000Z", level: "string", detail: "string", @@ -84,7 +73,6 @@ export class ProfileDisciplineController extends Controller { }, { id: "ba0e2f82-014e-46c6-8b82-a7c28eb5325f", - isActive: true, date: "2024-03-12T10:09:47.000Z", level: "string", detail: "string", @@ -97,17 +85,8 @@ export class ProfileDisciplineController extends Controller { public async disciplineHistory(@Path() disciplineId: string) { const record = await this.disciplineHistoryRepository.find({ where: { profileDisciplineId: disciplineId }, - select: [ - "id", - "isActive", - "date", - "level", - "detail", - "unStigma", - "refCommandNo", - "refCommandDate", - ], - order: { createdAt: "DESC" } + select: ["id", "date", "level", "detail", "unStigma", "refCommandNo", "refCommandDate"], + order: { createdAt: "DESC" }, }); return new HttpSuccess(record); } diff --git a/src/controllers/ProfileDutyController.ts b/src/controllers/ProfileDutyController.ts index d13a36d9..a690883b 100644 --- a/src/controllers/ProfileDutyController.ts +++ b/src/controllers/ProfileDutyController.ts @@ -36,7 +36,6 @@ export class ProfileDutyController extends Controller { result: [ { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, dateStart: "2024-03-12T10:09:47.000Z", dateEnd: "string", reference: "string", @@ -51,7 +50,6 @@ export class ProfileDutyController extends Controller { where: { profileId: profileId }, select: [ "id", - "isActive", "dateStart", "dateEnd", "reference", @@ -70,7 +68,6 @@ export class ProfileDutyController extends Controller { result: [ { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, dateStart: "2024-03-12T10:09:47.000Z", dateEnd: "string", reference: "string", @@ -80,7 +77,6 @@ export class ProfileDutyController extends Controller { }, { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, dateStart: "2024-03-12T10:09:47.000Z", dateEnd: "string", reference: "string", @@ -95,7 +91,6 @@ export class ProfileDutyController extends Controller { where: { profileDutyId: dutyId }, select: [ "id", - "isActive", "dateStart", "dateEnd", "reference", diff --git a/src/controllers/ProfileFamilyHistoryController.ts b/src/controllers/ProfileFamilyHistoryController.ts index 7a112091..aed19573 100644 --- a/src/controllers/ProfileFamilyHistoryController.ts +++ b/src/controllers/ProfileFamilyHistoryController.ts @@ -48,7 +48,6 @@ export class ProfileFamilyHistoryController extends Controller { lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: true, couple: true, couplePrefix: "string", coupleFirstName: "string", @@ -79,7 +78,6 @@ export class ProfileFamilyHistoryController extends Controller { lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: true, childrenCareer: "string", childrenFirstName: "string", childrenLastName: "string", @@ -124,7 +122,6 @@ export class ProfileFamilyHistoryController extends Controller { lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: true, couple: true, couplePrefix: "string", coupleFirstName: "string", @@ -155,7 +152,6 @@ export class ProfileFamilyHistoryController extends Controller { lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: false, childrenCareer: "hey", childrenFirstName: "hey", childrenLastName: "hey", @@ -174,7 +170,6 @@ export class ProfileFamilyHistoryController extends Controller { lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: false, childrenCareer: "ay", childrenFirstName: "ay", childrenLastName: "ay", @@ -195,7 +190,6 @@ export class ProfileFamilyHistoryController extends Controller { lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: true, couple: true, couplePrefix: "string", coupleFirstName: "string", diff --git a/src/controllers/ProfileHonorController.ts b/src/controllers/ProfileHonorController.ts index 96c76d86..9a03daa3 100644 --- a/src/controllers/ProfileHonorController.ts +++ b/src/controllers/ProfileHonorController.ts @@ -43,7 +43,6 @@ export class ProfileHonorController extends Controller { createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", - isActive: true, detail: "string", issueDate: "2024-03-12T10:09:47.000Z", issuer: "string", @@ -71,7 +70,6 @@ export class ProfileHonorController extends Controller { lastUpdateUserId: "00000000-0000-0000-0000-000000000000", createdFullName: "string", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: true, detail: "detail", issueDate: "2024-03-12T10:10:31.000Z", issuer: "issuer", @@ -88,7 +86,6 @@ export class ProfileHonorController extends Controller { lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: true, detail: "string", issueDate: "2024-03-12T10:09:47.000Z", issuer: "string", diff --git a/src/controllers/ProfileInsigniaController.ts b/src/controllers/ProfileInsigniaController.ts index d1d396b7..04adb1b2 100644 --- a/src/controllers/ProfileInsigniaController.ts +++ b/src/controllers/ProfileInsigniaController.ts @@ -47,7 +47,6 @@ export class ProfileInsigniaController extends Controller { createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", - isActive: true, year: 0, no: "string", volume: "string", @@ -90,7 +89,6 @@ export class ProfileInsigniaController extends Controller { lastUpdateUserId: "00000000-0000-0000-0000-000000000000", createdFullName: "string", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: true, year: 0, no: "no", volume: "volume", @@ -115,7 +113,6 @@ export class ProfileInsigniaController extends Controller { lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย", - isActive: true, year: 0, no: "string", volume: "string", diff --git a/src/controllers/ProfileNopaidController.ts b/src/controllers/ProfileNopaidController.ts index a0bd33d3..65ec27ec 100644 --- a/src/controllers/ProfileNopaidController.ts +++ b/src/controllers/ProfileNopaidController.ts @@ -36,7 +36,6 @@ export class ProfileNopaidController extends Controller { result: [ { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, date: "2024-03-12T10:09:47.000Z", reference: "string", detail: "string", @@ -59,7 +58,6 @@ export class ProfileNopaidController extends Controller { result: [ { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, date: "2024-03-12T10:09:47.000Z", reference: "string", detail: "string", @@ -68,7 +66,6 @@ export class ProfileNopaidController extends Controller { }, { id: "debfa8a7-83fb-4801-a940-8ae74e7638d3", - isActive: true, date: "2024-03-12T10:09:47.000Z", reference: "string", detail: "string",