hrms-api-org/src/entities/ProfileFamilyFather.ts
2024-05-15 14:34:21 +07:00

109 lines
2.7 KiB
TypeScript

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.profileFamilyFather)
histories: 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;
};