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; profileEmployeeId: string;
@OneToMany( @OneToMany(() => ProfileFamilyCoupleHistory, (v) => v.profileFamilyCouple)
() => ProfileFamilyCoupleHistory, histories: ProfileFamilyCoupleHistory[];
(v) => v.histories,
)
profileFamilyCouple: ProfileFamilyCoupleHistory[];
@ManyToOne(() => Profile, (v) => v.profileFamilyCouple) @ManyToOne(() => Profile, (v) => v.profileFamilyCouple)
@JoinColumn({ name: "profileId" }) @JoinColumn({ name: "profileId" })

View file

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

View file

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

View file

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

View file

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

View file

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