family entity (father, mother, couple)

This commit is contained in:
Bright 2024-05-14 17:39:32 +07:00
parent 291d3199d2
commit 968842557a
8 changed files with 575 additions and 0 deletions

View file

@ -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;

View file

@ -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")

View file

@ -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;
};

View file

@ -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;
}

View file

@ -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;
};

View file

@ -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;
}

View file

@ -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;
};

View file

@ -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;
}