Fix Entity

This commit is contained in:
Bright 2024-05-15 14:34:21 +07:00
parent 67c54e3273
commit b7ca6795cb
6 changed files with 49 additions and 35 deletions

View file

@ -90,11 +90,8 @@ export class ProfileFamilyCouple extends EntityBase {
})
profileEmployeeId: string;
@OneToMany(
() => ProfileFamilyCoupleHistory,
(v) => v.histories,
)
profileFamilyCouple: ProfileFamilyCoupleHistory[];
@OneToMany(() => ProfileFamilyCoupleHistory, (v) => v.profileFamilyCouple)
histories: ProfileFamilyCoupleHistory[];
@ManyToOne(() => Profile, (v) => v.profileFamilyCouple)
@JoinColumn({ name: "profileId" })

View file

@ -7,54 +7,78 @@ export class ProfileFamilyCoupleHistory extends EntityBase {
@Column({
nullable: true,
default: null,
comment: "คำนำหน้าบิดา",
type: "boolean",
})
fatherPrefix: string;
couple: boolean;
@Column({
nullable: true,
default: null,
comment: "ชื่อบิดา",
comment: "คำนำหน้าคู่สมรส",
})
fatherFirstName: string;
couplePrefix: string;
@Column({
nullable: true,
default: null,
comment: "นามสกุลบิดา",
comment: "ชื่อคู่สมรส",
})
fatherLastName: string;
coupleFirstName: string;
@Column({
nullable: true,
default: null,
comment: "อาชีพบิดา",
comment: "นามสกุลคู่สมรส",
})
fatherCareer: string;
coupleLastName: string;
@Column({
nullable: true,
default: null,
comment: "เลขที่บัตรประชาชนบิดา",
comment: "นามสกุลคู่สมรส(เดิม)",
})
fatherCitizenId: string;
coupleLastNameOld: string;
@Column({
nullable: true,
default: null,
comment: "มีชีวิตบิดา",
comment: "อาชีพคู่สมรส",
})
fatherLive: boolean;
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,
comment: "คีย์นอก(FK)ของตาราง ProfileFamilyFather",
comment: "คีย์นอก(FK)ของตาราง ProfileFamilyCouple",
default: null,
})
profileFamilyCoupleId: string;
@ManyToOne(() => ProfileFamilyCouple, (v) => v.profileFamilyCouple)
@ManyToOne(() => ProfileFamilyCouple, (v) => v.histories)
@JoinColumn({ name: "profileFamilyCoupleId" })
histories: ProfileFamilyCouple;
profileFamilyCouple: ProfileFamilyCouple;
}

View file

@ -66,11 +66,8 @@ export class ProfileFamilyFather extends EntityBase {
})
profileEmployeeId: string;
@OneToMany(
() => ProfileFamilyFatherHistory,
(v) => v.histories,
)
profileFamilyFather: ProfileFamilyFatherHistory[];
@OneToMany(() => ProfileFamilyFatherHistory, (v) => v.profileFamilyFather)
histories: ProfileFamilyFatherHistory[];
@ManyToOne(() => Profile, (v) => v.profileFamilyFather)
@JoinColumn({ name: "profileId" })

View file

@ -54,7 +54,7 @@ export class ProfileFamilyFatherHistory extends EntityBase {
})
profileFamilyFatherId: string;
@ManyToOne(() => ProfileFamilyFather, (v) => v.profileFamilyFather)
@ManyToOne(() => ProfileFamilyFather, (v) => v.histories)
@JoinColumn({ name: "profileFamilyFatherId" })
histories: ProfileFamilyFather;
profileFamilyFather: ProfileFamilyFather;
}

View file

@ -66,11 +66,8 @@ export class ProfileFamilyMother extends EntityBase {
})
profileEmployeeId: string;
@OneToMany(
() => ProfileFamilyMotherHistory,
(v) => v.histories,
)
profileFamilyMother: ProfileFamilyMotherHistory[];
@OneToMany(() => ProfileFamilyMotherHistory, (v) => v.profileFamilyMother)
histories: ProfileFamilyMotherHistory[];
@ManyToOne(() => Profile, (v) => v.profileFamilyMother)
@JoinColumn({ name: "profileId" })

View file

@ -4,7 +4,6 @@ import { ProfileFamilyMother } from "./ProfileFamilyMother";
@Entity("profileFamilyMotherHistory")
export class ProfileFamilyMotherHistory extends EntityBase {
@Column({
nullable: true,
default: null,
@ -55,7 +54,7 @@ export class ProfileFamilyMotherHistory extends EntityBase {
})
profileFamilyMotherId: string;
@ManyToOne(() => ProfileFamilyMother, (v) => v.profileFamilyMother)
@ManyToOne(() => ProfileFamilyMother, (v) => v.histories)
@JoinColumn({ name: "profileFamilyMotherId" })
histories: ProfileFamilyMother;
profileFamilyMother: ProfileFamilyMother;
}