hrms-api-org/src/entities/ProfileDutyHistory.ts

105 lines
2.1 KiB
TypeScript
Raw Normal View History

2024-03-13 10:43:50 +07:00
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileDuty } from "./ProfileDutys";
@Entity("profileDutyHistory")
export class ProfileDutyHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({
nullable: true,
type: "datetime",
comment: "เริ่มต้น",
default: null,
})
dateStart: Date;
@Column({
nullable: true,
type: "datetime",
comment: "สิ้นสุด",
default: null,
})
dateEnd: Date;
@Column({
nullable: true,
comment: "รายละเอียด",
type: "text",
default: null,
})
detail: string;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง",
type: "text",
default: null,
})
reference: string;
@Column({
nullable: true,
type: "datetime",
comment: "เอกสารอ้างอิง (ลงวันที่)",
default: null,
})
refCommandDate: Date;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
type: "text",
default: null,
})
refCommandNo: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileDuty",
default: null,
})
profileDutyId: string;
@ManyToOne(() => ProfileDuty, (profileDuty) => profileDuty.profileDutyHistories)
@JoinColumn({ name: "profileDutyId" })
histories: ProfileDuty;
}
export class CreateProfileDutyHistory {
@Column()
isActive: boolean;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
@Column()
detail: string | null;
@Column()
reference: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
@Column("uuid")
profileDutyId: string | null;
}
export type UpdateProfileDutyHistory = Partial<CreateProfileDutyHistory>;