fix: profile leave entity
This commit is contained in:
parent
be2b08c346
commit
2b24e43522
2 changed files with 16 additions and 36 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue