import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; import { ProfileEmployee } from "./ProfileEmployee"; import { ProfileChildren } from "./ProfileChildren"; @Entity("profileChildrenHistory") export class ProfileChildrenHistory extends EntityBase { @Column({ nullable: true, default: null, comment: "อาชีพบุตร", }) childrenCareer: string; @Column({ nullable: true, default: null, comment: "ชื่อบุตร", }) childrenFirstName: string; @Column({ nullable: true, default: null, comment: "นามสกุลบุตร", }) childrenLastName: string; @Column({ nullable: true, default: null, comment: "คำนำหน้าบุตร", }) childrenPrefix: string; @Column({ nullable: true, default: null, type: "boolean", comment: "มีชีวิตบุตร", }) childrenLive: boolean; @Column({ nullable: true, default: null, comment: "เลขที่บัตรประชาชนบุตร", }) childrenCitizenId: string; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง ProfileChildren", default: null, }) profileChildrenId: string; // @ManyToOne(() => ProfileChildren, (profileChildren) => profileChildren.profileChildrenHistories) // @JoinColumn({ name: "profileChildrenId" }) // histories: ProfileChildren; @ManyToOne(() => ProfileChildren, (v) => v.histories) @JoinColumn({ name: "profileChildrenId" }) profileChildrenHistories: ProfileChildren; } export type CreateChildren = { childrenCareer: string; childrenFirstName: string; childrenLastName: string; childrenPrefix: string; childrenLive: boolean; childrenCitizenId: string; }; export type UpdateChildren = { id: string; childrenCareer?: string | null; childrenFirstName?: string | null; childrenLastName?: string | null; childrenPrefix?: string | null; childrenLive?: boolean | null; childrenCitizenId?: string | null; }; export type CreateProfileFamily = { couple: boolean | null; couplePrefix: string | null; coupleFirstName: string | null; coupleLastName: string | null; coupleLastNameOld: string | null; coupleCareer: string | null; coupleCitizenId: string | null; coupleLive: boolean | null; fatherPrefix: string | null; fatherFirstName: string | null; fatherLastName: string | null; fatherCareer: string | null; fatherCitizenId: string | null; fatherLive: boolean | null; motherPrefix: string | null; motherFirstName: string | null; motherLastName: string | null; motherCareer: string | null; motherCitizenId: string | null; motherLive: boolean | null; profileId: string; children: CreateChildren[]; }; export type CreateProfileFamilyEmployee = { couple: boolean | null; couplePrefix: string | null; coupleFirstName: string | null; coupleLastName: string | null; coupleLastNameOld: string | null; coupleCareer: string | null; coupleCitizenId: string | null; coupleLive: boolean | null; fatherPrefix: string | null; fatherFirstName: string | null; fatherLastName: string | null; fatherCareer: string | null; fatherCitizenId: string | null; fatherLive: boolean | null; motherPrefix: string | null; motherFirstName: string | null; motherLastName: string | null; motherCareer: string | null; motherCitizenId: string | null; motherLive: boolean | null; profileEmployeeId: string | null; children: CreateChildren[]; }; export type UpdateProfileFamily = { couple?: boolean | null; couplePrefix?: string | null; coupleFirstName?: string | null; coupleLastName?: string | null; coupleLastNameOld?: string | null; coupleCareer?: string | null; coupleCitizenId?: string | null; coupleLive?: boolean | null; fatherPrefix?: string | null; fatherFirstName?: string | null; fatherLastName?: string | null; fatherCareer?: string | null; fatherCitizenId?: string | null; fatherLive?: boolean | null; motherPrefix?: string | null; motherFirstName?: string | null; motherLastName?: string | null; motherCareer?: string | null; motherCitizenId?: string | null; motherLive?: boolean | null; children: UpdateChildren[]; };