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] 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; }