115 lines
2.9 KiB
TypeScript
115 lines
2.9 KiB
TypeScript
import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { Profile } from "./Profile";
|
|
import { ProfileEmployee } from "./ProfileEmployee";
|
|
import { ProfileChildrenHistory } from "./ProfileChildrenHistory";
|
|
|
|
@Entity("profileChildren")
|
|
export class ProfileChildren extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "อาชีพบุตร",
|
|
})
|
|
childrenCareer: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "ชื่อบุตร",
|
|
})
|
|
childrenFirstName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "นามสกุลบุตร",
|
|
})
|
|
childrenLastName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "คำนำหน้าบุตร",
|
|
})
|
|
childrenPrefix: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
type: "boolean",
|
|
comment: "มีชีวิตบุตร",
|
|
})
|
|
childrenLive: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
default: null,
|
|
comment: "เลขที่บัตรประชาชนบุตร",
|
|
})
|
|
childrenCitizenId: 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;
|
|
|
|
@ManyToOne(() => Profile, (Profile) => Profile.profileChildrens)
|
|
@JoinColumn({ name: "profileId" })
|
|
profile: Profile;
|
|
|
|
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileChildrens)
|
|
@JoinColumn({ name: "profileEmployeeId" })
|
|
profileEmployee: ProfileEmployee;
|
|
|
|
// @OneToMany(
|
|
// () => ProfileChildrenHistory,
|
|
// (profileChildrenHistory) => profileChildrenHistory.histories,
|
|
// )
|
|
// profileChildrenHistories: ProfileChildrenHistory[];
|
|
|
|
@OneToMany(() => ProfileChildrenHistory, (v) => v.profileChildrenHistories)
|
|
histories: ProfileChildrenHistory[];
|
|
}
|
|
|
|
export type CreateProfileChildren = {
|
|
profileId: string;
|
|
childrenCareer: string | null;
|
|
childrenFirstName: string | null;
|
|
childrenLastName: string | null;
|
|
childrenPrefix: string | null;
|
|
childrenLive: boolean | null;
|
|
childrenCitizenId: string | null;
|
|
};
|
|
|
|
export type CreateProfileChildrenEmployee = {
|
|
profileEmployeeId: string;
|
|
childrenCareer: string;
|
|
childrenFirstName: string;
|
|
childrenLastName: string;
|
|
childrenPrefix: string;
|
|
childrenLive: boolean;
|
|
childrenCitizenId: string;
|
|
};
|
|
|
|
export type UpdateProfileChildren = {
|
|
// id: string;
|
|
childrenCareer?: string | null;
|
|
childrenFirstName?: string | null;
|
|
childrenLastName?: string | null;
|
|
childrenPrefix?: string | null;
|
|
childrenLive?: boolean | null;
|
|
childrenCitizenId?: string | null;
|
|
};
|