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

104 lines
2.2 KiB
TypeScript
Raw Normal View History

2024-03-12 14:53:15 +07:00
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileHonorHistory } from "./ProfileHonorHistory";
@Entity("profileHonor")
export class ProfileHonor extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({
nullable: true,
length: 2000,
comment: "รายละเอียด",
default: null,
})
detail: string;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่ได้รับ",
default: null,
})
issueDate: Date;
@Column({
nullable: true,
length: 200,
comment: "หน่วยงานที่ออก",
default: null,
})
issuer: string;
@Column({
nullable: true,
type: "datetime",
comment: "เอกสารอ้างอิง (ลงวันที่)",
default: null,
})
refCommandDate: Date;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
type: "text",
default: null,
})
refCommandNo: string;
@Column({
nullable: true,
comment: "ประเภทช่วงเวลาการศึกษา",
default: null,
})
isDate: boolean;
@OneToMany(() => ProfileHonorHistory, (profileHonorHistory) => profileHonorHistory.histories)
profileHonorHistories: ProfileHonorHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileHonors)
@JoinColumn({ name: "profileId" })
profile: Profile;
}
export class CreateProfileHonor {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
detail: string | null;
@Column()
issueDate: Date | null;
@Column()
issuer: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
@Column()
isDate: boolean | null;
}
export type UpdateProfileHonor = Partial<CreateProfileHonor>;