319 lines
7.2 KiB
TypeScript
319 lines
7.2 KiB
TypeScript
import { Column, Entity, ManyToOne, OneToMany } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { Profile } from "./Profile";
|
|
|
|
@Entity("profileFamilyHistory")
|
|
export class ProfileFamilyHistory extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
type: "boolean",
|
|
})
|
|
couple: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "คำนำหน้าคู่สมรส",
|
|
})
|
|
couplePrefix: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "ชื่อคู่สมรส",
|
|
})
|
|
coupleFirstName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "นามสกุลคู่สมรส",
|
|
})
|
|
coupleLastName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "นามสกุลคู่สมรส(เดิม)",
|
|
})
|
|
coupleLastNameOld: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "อาชีพคู่สมรส",
|
|
})
|
|
coupleCareer: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
length: 13,
|
|
comment: "เลขที่บัตรประชาชนคู่สมรส",
|
|
})
|
|
coupleCitizenId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
type: "boolean",
|
|
comment: "มีชีวิตคู่สมรส",
|
|
})
|
|
coupleLive: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "คำนำหน้าบิดา",
|
|
})
|
|
fatherPrefix: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "ชื่อบิดา",
|
|
})
|
|
fatherFirstName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "นามสกุลบิดา",
|
|
})
|
|
fatherLastName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "อาชีพบิดา",
|
|
})
|
|
fatherCareer: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "เลขที่บัตรประชาชนบิดา",
|
|
})
|
|
fatherCitizenId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "มีชีวิตบิดา",
|
|
})
|
|
fatherLive: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "คำนำหน้ามารดา",
|
|
})
|
|
motherPrefix: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "ชื่อมารดา",
|
|
})
|
|
motherFirstName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "นามสกุลมารดา",
|
|
})
|
|
motherLastName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "อาชีพบิดา",
|
|
})
|
|
motherCareer: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "เลขที่บัตรประชาชนมารดา",
|
|
})
|
|
motherCitizenId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "มีชีวิตมารดา",
|
|
})
|
|
motherLive: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
type: "uuid",
|
|
comment: "คีย์นอก(FK) ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileId: string;
|
|
|
|
@ManyToOne(() => Profile, (v) => v.profileFamily)
|
|
profile: Profile;
|
|
|
|
@OneToMany(() => ProfileChildrenHistory, (v) => v.profileFamilyHistory)
|
|
profileChildrenHistories: ProfileChildrenHistory[];
|
|
}
|
|
|
|
@Entity("profileChildren")
|
|
export class ProfileChildren 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,
|
|
type: "uuid",
|
|
comment: "คีย์นอก(FK) ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileId: string;
|
|
|
|
@ManyToOne(() => Profile, (v) => v.profileFamily, { onDelete: "CASCADE" })
|
|
profile: Profile;
|
|
|
|
@OneToMany(() => ProfileChildrenHistory, (v) => v.profileChildren)
|
|
histories: Profile;
|
|
}
|
|
|
|
@Entity("profileChildrenHistory")
|
|
export class ProfileChildrenHistory extends ProfileChildren {
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
type: "uuid",
|
|
comment: "คีย์นอก(FK) ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileFamilyHistoryId: string;
|
|
|
|
@ManyToOne(() => ProfileFamilyHistory, (v) => v.profileChildrenHistories, { onDelete: "CASCADE" })
|
|
profileFamilyHistory: ProfileFamilyHistory;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
type: "uuid",
|
|
comment: "คีย์นอก(FK) ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileChildrenId: string;
|
|
|
|
@ManyToOne(() => ProfileChildren, (v) => v.histories, { onDelete: "CASCADE" })
|
|
profileChildren: 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 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[];
|
|
};
|