From 968842557a0e1a19f3c13e75c6765a812a3bd536 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 14 May 2024 17:39:32 +0700 Subject: [PATCH] family entity (father, mother, couple) --- src/entities/Profile.ts | 12 ++ src/entities/ProfileEmployee.ts | 13 ++ src/entities/ProfileFamilyCouple.ts | 145 +++++++++++++++++++++ src/entities/ProfileFamilyCoupleHistory.ts | 60 +++++++++ src/entities/ProfileFamilyFather.ts | 112 ++++++++++++++++ src/entities/ProfileFamilyFatherHistory.ts | 60 +++++++++ src/entities/ProfileFamilyMother.ts | 112 ++++++++++++++++ src/entities/ProfileFamilyMotherHistory.ts | 61 +++++++++ 8 files changed, 575 insertions(+) create mode 100644 src/entities/ProfileFamilyCouple.ts create mode 100644 src/entities/ProfileFamilyCoupleHistory.ts create mode 100644 src/entities/ProfileFamilyFather.ts create mode 100644 src/entities/ProfileFamilyFatherHistory.ts create mode 100644 src/entities/ProfileFamilyMother.ts create mode 100644 src/entities/ProfileFamilyMotherHistory.ts diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index 1d7b8d04..a3f376a2 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -22,6 +22,9 @@ import { Province } from "./Province"; import { SubDistrict } from "./SubDistrict"; import { District } from "./District"; import { ProfileAvatar } from "./ProfileAvatar"; +import { ProfileFamilyFather } from "./ProfileFamilyFather"; +import { ProfileFamilyMother } from "./ProfileFamilyMother"; +import { ProfileFamilyCouple } from "./ProfileFamilyCouple"; @Entity("profile") export class Profile extends EntityBase { @@ -317,6 +320,15 @@ export class Profile extends EntityBase { @OneToMany(() => ProfileHistory, (v) => v.profile) histories: ProfileHistory[]; + @OneToMany(() => ProfileFamilyFather, (v) => v.profile) + profileFamilyFather: ProfileFamilyFather[]; + + @OneToMany(() => ProfileFamilyMother, (v) => v.profile) + profileFamilyMother: ProfileFamilyMother[]; + + @OneToMany(() => ProfileFamilyCouple , (v) => v.profile) + profileFamilyCouple: ProfileFamilyCouple[]; + @ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles) @JoinColumn({ name: "posLevelId" }) posLevel: PosLevel; diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index 53d5b1cd..f9816235 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -21,6 +21,10 @@ import { ProfileAbility } from "./ProfileAbility"; import { ProfileOther } from "./ProfileOther"; import { ProfileAvatar } from "./ProfileAvatar"; import { ProfileGovernment } from "./ProfileGovernment"; +import { ProfileFamilyFather } from "./ProfileFamilyFather"; +import { ProfileFamilyMother } from "./ProfileFamilyMother"; +import { ProfileFamilyCouple } from "./ProfileFamilyCouple"; + @Entity("profileEmployee") export class ProfileEmployee extends EntityBase { @Column({ @@ -278,6 +282,15 @@ export class ProfileEmployee extends EntityBase { @OneToMany(() => ProfileGovernment, (v) => v.profileEmployee) profileGovernment: ProfileGovernment[]; + + @OneToMany(() => ProfileFamilyFather, (v) => v.profile) + profileFamilyFather: ProfileFamilyFather[]; + + @OneToMany(() => ProfileFamilyMother, (v) => v.profile) + profileFamilyMother: ProfileFamilyMother[]; + + @OneToMany(() => ProfileFamilyCouple , (v) => v.profile) + profileFamilyCouple: ProfileFamilyCouple[]; } @Entity("profileEmployeeHistory") diff --git a/src/entities/ProfileFamilyCouple.ts b/src/entities/ProfileFamilyCouple.ts new file mode 100644 index 00000000..0157177c --- /dev/null +++ b/src/entities/ProfileFamilyCouple.ts @@ -0,0 +1,145 @@ +import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileEmployee } from "./ProfileEmployee"; +import { ProfileFamilyCoupleHistory } from "./ProfileFamilyCoupleHistory"; + +@Entity("profileFamilyCouple") +export class ProfileFamilyCouple 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, + comment: "ความสัมพันธ์", + length: 40, + default: null, + }) + relationship: string; + + @Column({ + nullable: true, + length: 40, + type: "uuid", + comment: "คีย์นอก(FK) ของตาราง Profile", + default: null, + }) + profileId: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileEmployee", + default: null, + }) + profileEmployeeId: string; + + @OneToMany( + () => ProfileFamilyCoupleHistory, + (v) => v.histories, + ) + profileFamilyCouple: ProfileFamilyCoupleHistory[]; + + @ManyToOne(() => Profile, (v) => v.profileFamilyCouple) + @JoinColumn({ name: "profileId" }) + profile: Profile; + + @ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyCouple) + @JoinColumn({ name: "profileEmployeeId" }) + profileEmployee: ProfileEmployee; + +} + +export type CreateProfileFamilyCouple= { + profileId: string; + couple: boolean | null; + couplePrefix: string | null; + coupleFirstName: string | null; + coupleLastName: string | null; + coupleLastNameOld: string | null; + coupleCareer: string | null; + coupleCitizenId: string | null; + coupleLive: boolean | null; + relationship: string | null; +} + +export type CreateProfileEmployeeFamilyCouple= { + profileEmployeeId: string; + couple: boolean | null; + couplePrefix: string | null; + coupleFirstName: string | null; + coupleLastName: string | null; + coupleLastNameOld: string | null; + coupleCareer: string | null; + coupleCitizenId: string | null; + coupleLive: boolean | null; + relationship: string | null; +} + +export type UpdateProfileFamilyCouple = { + couple?: boolean | null; + couplePrefix?: string | null; + coupleFirstName?: string | null; + coupleLastName?: string | null; + coupleLastNameOld?: string | null; + coupleCareer?: string | null; + coupleCitizenId?: string | null; + coupleLive?: boolean | null; + relationship: string | null; +}; diff --git a/src/entities/ProfileFamilyCoupleHistory.ts b/src/entities/ProfileFamilyCoupleHistory.ts new file mode 100644 index 00000000..d831bf3a --- /dev/null +++ b/src/entities/ProfileFamilyCoupleHistory.ts @@ -0,0 +1,60 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { ProfileFamilyCouple } from "./ProfileFamilyCouple"; + +@Entity("profileFamilyCoupleHistory") +export class ProfileFamilyCoupleHistory extends EntityBase { + @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, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileFamilyFather", + default: null, + }) + profileFamilyCoupleId: string; + + @ManyToOne(() => ProfileFamilyCouple, (v) => v.profileFamilyCouple) + @JoinColumn({ name: "profileFamilyCoupleId" }) + histories: ProfileFamilyCouple; +} diff --git a/src/entities/ProfileFamilyFather.ts b/src/entities/ProfileFamilyFather.ts new file mode 100644 index 00000000..8b56d64e --- /dev/null +++ b/src/entities/ProfileFamilyFather.ts @@ -0,0 +1,112 @@ +import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileEmployee } from "./ProfileEmployee"; +import { ProfileFamilyFatherHistory } from "./ProfileFamilyFatherHistory"; + +@Entity("profileFamilyFather") +export class ProfileFamilyFather extends EntityBase { + + @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, + length: 40, + type: "uuid", + comment: "คีย์นอก(FK) ของตาราง Profile", + default: null, + }) + profileId: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileEmployee", + default: null, + }) + profileEmployeeId: string; + + @OneToMany( + () => ProfileFamilyFatherHistory, + (v) => v.histories, + ) + profileFamilyFather: ProfileFamilyFatherHistory[]; + + @ManyToOne(() => Profile, (v) => v.profileFamilyFather) + @JoinColumn({ name: "profileId" }) + profile: Profile; + + @ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyFather) + @JoinColumn({ name: "profileEmployeeId" }) + profileEmployee: ProfileEmployee; + +} + +export type CreateProfileFamilyFather = { + profileId: string; + fatherPrefix: string | null; + fatherFirstName: string | null; + fatherLastName: string | null; + fatherCareer: string | null; + fatherCitizenId: string | null; + fatherLive: boolean | null; +} + +export type CreateProfileEmployeeFamilyFather = { + profileEmployeeId: string; + fatherPrefix: string | null; + fatherFirstName: string | null; + fatherLastName: string | null; + fatherCareer: string | null; + fatherCitizenId: string | null; + fatherLive: boolean | null; +} + +export type UpdateProfileFamilyFather = { + fatherPrefix?: string | null; + fatherFirstName?: string | null; + fatherLastName?: string | null; + fatherCareer?: string | null; + fatherCitizenId?: string | null; + fatherLive?: boolean | null; +}; diff --git a/src/entities/ProfileFamilyFatherHistory.ts b/src/entities/ProfileFamilyFatherHistory.ts new file mode 100644 index 00000000..dd99f6be --- /dev/null +++ b/src/entities/ProfileFamilyFatherHistory.ts @@ -0,0 +1,60 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { ProfileFamilyFather } from "./ProfileFamilyFather"; + +@Entity("profileFamilyFatherHistory") +export class ProfileFamilyFatherHistory extends EntityBase { + @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, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileFamilyFather", + default: null, + }) + profileFamilyFatherId: string; + + @ManyToOne(() => ProfileFamilyFather, (v) => v.profileFamilyFather) + @JoinColumn({ name: "profileFamilyFatherId" }) + histories: ProfileFamilyFather; +} diff --git a/src/entities/ProfileFamilyMother.ts b/src/entities/ProfileFamilyMother.ts new file mode 100644 index 00000000..c143237d --- /dev/null +++ b/src/entities/ProfileFamilyMother.ts @@ -0,0 +1,112 @@ +import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileEmployee } from "./ProfileEmployee"; +import { ProfileFamilyMotherHistory } from "./ProfileFamilyMotherHistory"; + +@Entity("profileFamilyMother") +export class ProfileFamilyMother extends EntityBase { + + @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; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileEmployee", + default: null, + }) + profileEmployeeId: string; + + @OneToMany( + () => ProfileFamilyMotherHistory, + (v) => v.histories, + ) + profileFamilyMother: ProfileFamilyMotherHistory[]; + + @ManyToOne(() => Profile, (v) => v.profileFamilyMother) + @JoinColumn({ name: "profileId" }) + profile: Profile; + + @ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyMother) + @JoinColumn({ name: "profileEmployeeId" }) + profileEmployee: ProfileEmployee; + +} + +export type CreateProfileFamilyMother = { + profileId: string; + motherPrefix: string | null; + motherFirstName: string | null; + motherLastName: string | null; + motherCareer: string | null; + motherCitizenId: string | null; + motherLive: boolean | null; +} + +export type CreateProfileEmployeeFamilyMother= { + profileEmployeeId: string; + motherPrefix: string | null; + motherFirstName: string | null; + motherLastName: string | null; + motherCareer: string | null; + motherCitizenId: string | null; + motherLive: boolean | null; +} + +export type UpdateProfileFamilyMother= { + motherPrefix: string | null; + motherFirstName: string | null; + motherLastName: string | null; + motherCareer: string | null; + motherCitizenId: string | null; + motherLive: boolean | null; +}; diff --git a/src/entities/ProfileFamilyMotherHistory.ts b/src/entities/ProfileFamilyMotherHistory.ts new file mode 100644 index 00000000..90fd6a90 --- /dev/null +++ b/src/entities/ProfileFamilyMotherHistory.ts @@ -0,0 +1,61 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { ProfileFamilyMother } from "./ProfileFamilyMother"; + +@Entity("profileFamilyMotherHistory") +export class ProfileFamilyMotherHistory extends EntityBase { + + @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, + comment: "คีย์นอก(FK)ของตาราง ProfileFamilyMother", + default: null, + }) + profileFamilyMotherId: string; + + @ManyToOne(() => ProfileFamilyMother, (v) => v.profileFamilyMother) + @JoinColumn({ name: "profileFamilyMotherId" }) + histories: ProfileFamilyMother; +}