2024-03-21 11:28:02 +07:00
|
|
|
import { Entity, Column, OneToMany, ManyToOne } from "typeorm";
|
2024-03-15 14:32:08 +07:00
|
|
|
import { EntityBase } from "./base/Base";
|
|
|
|
|
import { EmployeePosLevel } from "./EmployeePosLevel";
|
|
|
|
|
import { EmployeePosType } from "./EmployeePosType";
|
|
|
|
|
import { EmployeePosMaster } from "./EmployeePosMaster";
|
2024-03-16 12:05:45 +07:00
|
|
|
import { ProfileSalaryEmployee } from "./ProfileSalaryEmployee";
|
|
|
|
|
import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee";
|
2024-03-15 14:32:08 +07:00
|
|
|
|
|
|
|
|
@Entity("profileEmployee")
|
|
|
|
|
export class ProfileEmployee extends EntityBase {
|
2024-03-26 23:07:55 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "ยศ",
|
|
|
|
|
length: 40,
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
|
|
|
|
rank: string;
|
|
|
|
|
|
2024-03-15 14:32:08 +07:00
|
|
|
@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;
|
|
|
|
|
|
2024-03-18 13:51:10 +07:00
|
|
|
@Column({
|
|
|
|
|
type: "double",
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "ขั้นเงินเดือน",
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
|
|
|
|
salaryLevel: number | null;
|
|
|
|
|
|
2024-03-21 22:59:39 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "กลุ่มบัญชีการจ้าง",
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
|
|
|
|
group: number;
|
|
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "เชื้อชาติ",
|
|
|
|
|
length: 255,
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
|
|
|
|
ethnicity: string;
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "เบอร์โทร",
|
|
|
|
|
length: 255,
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
|
|
|
|
telephoneNumber: string;
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "เพศ",
|
|
|
|
|
length: 40,
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
2024-03-26 23:07:55 +07:00
|
|
|
gender: string;
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "ความสัมพันธ์",
|
|
|
|
|
length: 40,
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
2024-03-26 23:07:55 +07:00
|
|
|
relationship: string;
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 16:29:51 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "ศาสนา",
|
|
|
|
|
length: 255,
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
2024-03-26 23:07:55 +07:00
|
|
|
religion: string;
|
2024-03-21 16:29:51 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "กรุ๊ปเลือด",
|
|
|
|
|
length: 40,
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
2024-03-26 23:07:55 +07:00
|
|
|
bloodGroup: string;
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@OneToMany(() => EmployeePosMaster, (v) => v.current_holder)
|
|
|
|
|
current_holders: EmployeePosMaster[];
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@OneToMany(() => EmployeePosMaster, (v) => v.next_holder)
|
|
|
|
|
next_holders: EmployeePosMaster[];
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@OneToMany(() => ProfileSalaryEmployee, (v) => v.profile)
|
|
|
|
|
profileSalary: ProfileSalaryEmployee[];
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@OneToMany(() => ProfileDisciplineEmployee, (v) => v.profile)
|
|
|
|
|
profileDiscipline: ProfileDisciplineEmployee[];
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@ManyToOne(() => EmployeePosLevel, (v) => v.profiles)
|
2024-03-15 14:32:08 +07:00
|
|
|
posLevel: EmployeePosLevel;
|
|
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
@ManyToOne(() => EmployeePosType, (v) => v.profiles)
|
2024-03-15 14:32:08 +07:00
|
|
|
posType: EmployeePosType;
|
2024-03-21 11:28:02 +07:00
|
|
|
|
|
|
|
|
@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;
|
2024-03-15 14:32:08 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class CreateProfileEmployee {
|
2024-03-26 23:07:55 +07:00
|
|
|
rank: string;
|
2024-03-15 14:32:08 +07:00
|
|
|
prefix: string;
|
|
|
|
|
firstName: string;
|
|
|
|
|
lastName: string;
|
|
|
|
|
position: string;
|
2024-03-21 11:28:02 +07:00
|
|
|
isProbation: boolean | null;
|
|
|
|
|
dateRetire: Date | null;
|
|
|
|
|
birthDate: Date | null;
|
|
|
|
|
salaryLevel: number | null;
|
|
|
|
|
ethnicity: string | null;
|
|
|
|
|
telephoneNumber: string | null;
|
|
|
|
|
citizenId: string;
|
2024-03-26 23:07:55 +07:00
|
|
|
religion: string | null;
|
2024-03-15 14:32:08 +07:00
|
|
|
posLevelId: string | null;
|
|
|
|
|
posTypeId: string | null;
|
2024-03-26 23:07:55 +07:00
|
|
|
gender: string | null;
|
|
|
|
|
relationship: string | null;
|
|
|
|
|
bloodGroup: string | null;
|
2024-03-15 14:32:08 +07:00
|
|
|
}
|
|
|
|
|
|
2024-03-21 11:28:02 +07:00
|
|
|
export type UpdateProfileEmployee = {
|
2024-03-26 23:07:55 +07:00
|
|
|
rank?: string | null;
|
2024-03-21 11:28:02 +07:00
|
|
|
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;
|
2024-03-26 23:07:55 +07:00
|
|
|
religion: string | null;
|
2024-03-21 11:28:02 +07:00
|
|
|
posLevelId?: string | null;
|
|
|
|
|
posTypeId?: string | null;
|
2024-03-26 23:07:55 +07:00
|
|
|
gender?: string | null;
|
|
|
|
|
relationship?: string | null;
|
|
|
|
|
bloodGroup?: string | null;
|
2024-03-21 11:28:02 +07:00
|
|
|
};
|