122 lines
2.8 KiB
TypeScript
122 lines
2.8 KiB
TypeScript
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
|
|
import { ProfileEmployee } from "./ProfileEmployee";
|
|
import { Profile } from "./Profile";
|
|
// import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
|
|
|
|
@Entity("profileChangeName")
|
|
export class ProfileChangeName extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "Id คำนำหน้า",
|
|
default: null,
|
|
})
|
|
prefixId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คำนำหน้า",
|
|
default: null,
|
|
})
|
|
prefix: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 100,
|
|
comment: "ชื่อ",
|
|
default: null,
|
|
})
|
|
firstName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 100,
|
|
comment: "นามสกุล",
|
|
default: null,
|
|
})
|
|
lastName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 100,
|
|
comment: "สถานะ",
|
|
default: null,
|
|
})
|
|
status: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "",
|
|
default: null,
|
|
})
|
|
documentId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
|
default: null,
|
|
})
|
|
profileEmployeeId: string;
|
|
|
|
@Column({
|
|
comment: "ข้อมูลจาก Entry",
|
|
default: false,
|
|
})
|
|
isEntry: boolean;
|
|
|
|
@OneToMany(
|
|
() => ProfileChangeNameHistory,
|
|
(profileChangeNameHistory) => profileChangeNameHistory.histories,
|
|
)
|
|
profileChangeNameHistories: ProfileChangeNameHistory[];
|
|
|
|
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileChangeNames)
|
|
@JoinColumn({ name: "profileEmployeeId" })
|
|
profileEmployee: ProfileEmployee;
|
|
|
|
@ManyToOne(() => Profile, (Profile) => Profile.profileChangeNames)
|
|
@JoinColumn({ name: "profileId" })
|
|
profile: Profile;
|
|
}
|
|
|
|
export class CreateProfileChangeName {
|
|
profileId: string | null;
|
|
prefixId: string | null;
|
|
prefix: string | null;
|
|
firstName: string | null;
|
|
lastName: string | null;
|
|
status: string | null;
|
|
documentId: string | null;
|
|
}
|
|
|
|
export class CreateProfileChangeNameEmployee {
|
|
profileEmployeeId: string | null;
|
|
prefixId: string | null;
|
|
prefix: string | null;
|
|
firstName: string | null;
|
|
lastName: string | null;
|
|
status: string | null;
|
|
documentId: string | null;
|
|
}
|
|
|
|
export type UpdateProfileChangeName = {
|
|
prefixId?: string | null;
|
|
prefix?: string | null;
|
|
firstName?: string | null;
|
|
lastName?: string | null;
|
|
status?: string | null;
|
|
documentId?: string | null;
|
|
};
|