import { Column, Entity, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; import { ProfileEmployee } from "./ProfileEmployee"; @Entity("profileGovernment") export class ProfileGovernment extends EntityBase { @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง Profile", default: null, }) profileId: string; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง ProfileEmployee", default: null, }) profileEmployeeId: string; @Column({ nullable: true, type: "datetime", comment: "วันที่บรรจุ", default: null, }) dateAppoint: Date; @Column({ nullable: true, type: "datetime", comment: "วันที่เริ่มปฏิบัติราชการ", default: null, }) dateStart: Date; @Column({ nullable: true, comment: "ขาดราชการ", default: null, }) govAgeAbsent: number; @Column({ nullable: true, comment: "อายุราชการเกื้อกูล", default: null, }) govAgePlus: number; @Column({ nullable: true, comment: "เหตุผลกรณีวันไม่ตรงกัน", length: 255, default: null, }) reasonSameDate: string; @ManyToOne(() => Profile, (v) => v.profileGovernment) @JoinColumn({ name: "profileId" }) profile: Profile; @ManyToOne(() => ProfileEmployee, (v) => v.profileGovernment) @JoinColumn({ name: "profileEmployeeId" }) profileEmployee: ProfileEmployee; } export type CreateProfileGovernment = { profileId: string; dateAppoint?: Date | null; dateStart?: Date | null; reasonSameDate?: string | null; }; export type CreateProfileEmployeeGovernment = { profileEmployeeId: string; dateAppoint?: Date | null; dateStart?: Date | null; reasonSameDate?: string | null; }; export type UpdateProfileGovernment = { dateAppoint?: Date | null; dateStart?: Date | null; reasonSameDate?: string | null; };