142 lines
3.4 KiB
TypeScript
142 lines
3.4 KiB
TypeScript
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.profileFamilyCouple)
|
|
histories: 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;
|
|
};
|