hrms-api-org/src/entities/ProfileFamilyMother.ts
2024-11-07 10:51:50 +07:00

114 lines
2.8 KiB
TypeScript

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: "นามสกุลมารดาเดิม",
})
motherLastNameOld: 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.profileFamilyMother)
histories: 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;
};