import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; import { ProfileEmployee } from "./ProfileEmployee"; import { ProfileNopaidHistory } from "./ProfileNopaidHistory"; @Entity("profileNopaid") export class ProfileNopaid 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, }) date: 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({ comment: "แนบไฟล์เอกสาร", default: false, }) isUpload: boolean; @Column({ nullable: false, comment: "ข้อมูลจาก Entry", default: false, }) isEntry: boolean; @OneToMany(() => ProfileNopaidHistory, (profileNopaidHistory) => profileNopaidHistory.histories) profileNopaidHistories: ProfileNopaidHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileNopaids) @JoinColumn({ name: "profileId" }) profile: Profile; @ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileNopaids) @JoinColumn({ name: "profileEmployeeId" }) profileEmployee: ProfileEmployee; } export class CreateProfileNopaid { profileId: string | null; date: Date | null; detail: string | null; reference: string | null; refCommandDate: Date | null; refCommandNo: string | null; isUpload?: boolean | null; } export class CreateProfileEmployeeNopaid { profileEmployeeId: string | null; date: Date | null; detail: string | null; reference: string | null; refCommandDate: Date | null; refCommandNo: string | null; isUpload?: boolean | null; } export type UpdateProfileNopaid = { date?: Date | null; detail?: string | null; reference?: string | null; refCommandDate?: Date | null; refCommandNo?: string | null; isUpload?: boolean | null; };