255 lines
5.7 KiB
TypeScript
255 lines
5.7 KiB
TypeScript
import { Entity, Column, OneToMany, ManyToOne } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { EmployeePosLevel } from "./EmployeePosLevel";
|
|
import { EmployeePosType } from "./EmployeePosType";
|
|
import { EmployeePosMaster } from "./EmployeePosMaster";
|
|
import { ProfileSalaryEmployee } from "./ProfileSalaryEmployee";
|
|
import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee";
|
|
import { BloodGroup } from "./BloodGroup";
|
|
import { Relationship } from "./Relationship";
|
|
import { Gender } from "./Gender";
|
|
import { Religion } from "./Religion";
|
|
|
|
@Entity("profileEmployee")
|
|
export class ProfileEmployee extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
comment: "คำนำหน้าชื่อ",
|
|
length: 40,
|
|
default: null,
|
|
})
|
|
prefix: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ชื่อ",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
firstName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "นามสกุล",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
lastName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เลขประจำตัวประชาชน",
|
|
default: null,
|
|
length: 13,
|
|
})
|
|
citizenId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ตำแหน่ง",
|
|
default: null,
|
|
length: 255,
|
|
})
|
|
position: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "ไอดีระดับตำแหน่ง",
|
|
})
|
|
posLevelId: string | null;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "ไอดีกลุ่มงานตำแหน่ง",
|
|
})
|
|
posTypeId: string | null;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 255,
|
|
comment: "อีเมล",
|
|
})
|
|
email: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 20,
|
|
comment: "เบอร์โทร",
|
|
})
|
|
phone: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "id keycloak",
|
|
length: 40,
|
|
default: null,
|
|
})
|
|
keycloak: string;
|
|
|
|
@Column({
|
|
comment: "ทดลองปฏิบัติหน้าที่",
|
|
default: false,
|
|
})
|
|
isProbation: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
type: "datetime",
|
|
comment: "วันที่พักราชการ",
|
|
default: null,
|
|
})
|
|
dateRetire: Date;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
type: "datetime",
|
|
comment: "วันเกิด",
|
|
default: null,
|
|
})
|
|
birthDate: Date;
|
|
|
|
@Column({
|
|
type: "double",
|
|
nullable: true,
|
|
comment: "ขั้นเงินเดือน",
|
|
default: null,
|
|
})
|
|
salaryLevel: number | null;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เชื้อชาติ",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
ethnicity: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เบอร์โทร",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
telephoneNumber: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เพศ",
|
|
length: 40,
|
|
default: null,
|
|
})
|
|
genderId: string;
|
|
|
|
@ManyToOne(() => Gender, (v) => v.profileEmployee)
|
|
gender: Gender;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ความสัมพันธ์",
|
|
length: 40,
|
|
default: null,
|
|
})
|
|
relationshipId: string;
|
|
|
|
@ManyToOne(() => Relationship, (v) => v.profileEmployee)
|
|
relationship: Relationship;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ศาสนา",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
religionId: string;
|
|
|
|
@ManyToOne(() => Religion, (v) => v.profile)
|
|
religion: Religion;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "กรุ๊ปเลือด",
|
|
length: 40,
|
|
default: null,
|
|
})
|
|
bloodGroupId: string;
|
|
|
|
@ManyToOne(() => BloodGroup, (v) => v.profileEmployee)
|
|
bloodGroup: BloodGroup;
|
|
|
|
@OneToMany(() => EmployeePosMaster, (v) => v.current_holder)
|
|
current_holders: EmployeePosMaster[];
|
|
|
|
@OneToMany(() => EmployeePosMaster, (v) => v.next_holder)
|
|
next_holders: EmployeePosMaster[];
|
|
|
|
@OneToMany(() => ProfileSalaryEmployee, (v) => v.profile)
|
|
profileSalary: ProfileSalaryEmployee[];
|
|
|
|
@OneToMany(() => ProfileDisciplineEmployee, (v) => v.profile)
|
|
profileDiscipline: ProfileDisciplineEmployee[];
|
|
|
|
@ManyToOne(() => EmployeePosLevel, (v) => v.profiles)
|
|
posLevel: EmployeePosLevel;
|
|
|
|
@ManyToOne(() => EmployeePosType, (v) => v.profiles)
|
|
posType: EmployeePosType;
|
|
|
|
@OneToMany(() => ProfileEmployeeHistory, (v) => v.profileEmployee)
|
|
histories: ProfileEmployeeHistory[];
|
|
}
|
|
|
|
@Entity("profileEmployeeHistory")
|
|
export class ProfileEmployeeHistory extends ProfileEmployee {
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง ProfileInformation",
|
|
default: null,
|
|
})
|
|
profileEmployeeId: string;
|
|
|
|
@ManyToOne(() => ProfileEmployee, (v) => v.histories, { onDelete: "CASCADE" })
|
|
profileEmployee: ProfileEmployee;
|
|
}
|
|
|
|
export class CreateProfileEmployee {
|
|
prefix: string;
|
|
firstName: string;
|
|
lastName: string;
|
|
position: string;
|
|
isProbation: boolean | null;
|
|
dateRetire: Date | null;
|
|
birthDate: Date | null;
|
|
salaryLevel: number | null;
|
|
ethnicity: string | null;
|
|
telephoneNumber: string | null;
|
|
citizenId: string;
|
|
religionId: string | null;
|
|
posLevelId: string | null;
|
|
posTypeId: string | null;
|
|
genderId: string | null;
|
|
relationshipId: string | null;
|
|
bloodGroupId: string | null;
|
|
}
|
|
|
|
export type UpdateProfileEmployee = {
|
|
prefix?: string | null;
|
|
firstName?: string | null;
|
|
lastName?: string | null;
|
|
position?: string | null;
|
|
isProbation?: boolean | null;
|
|
dateRetire?: Date | null;
|
|
birthDate?: Date | null;
|
|
salaryLevel?: number | null;
|
|
ethnicity?: string | null;
|
|
telephoneNumber?: string | null;
|
|
citizenId?: string;
|
|
religionId: string | null;
|
|
posLevelId?: string | null;
|
|
posTypeId?: string | null;
|
|
genderId?: string | null;
|
|
relationshipId?: string | null;
|
|
bloodGroupId?: string | null;
|
|
};
|