2024-03-15 14:32:08 +07:00
|
|
|
import { Entity, Column, OneToMany, OneToOne, JoinColumn, ManyToMany, ManyToOne } from "typeorm";
|
|
|
|
|
import { EntityBase } from "./base/Base";
|
|
|
|
|
import { PosMaster } from "./PosMaster";
|
|
|
|
|
import { PosLevel } from "./PosLevel";
|
|
|
|
|
import { PosType } from "./PosType";
|
|
|
|
|
import { ProfileSalary } from "./ProfileSalary";
|
|
|
|
|
import { ProfileDiscipline } from "./ProfileDiscipline";
|
|
|
|
|
import { ProfileCertificate } from "./ProfileCertificate";
|
|
|
|
|
import { ProfileEducation } from "./ProfileEducation";
|
|
|
|
|
import { ProfileTraining } from "./ProfileTraining";
|
|
|
|
|
import { ProfileInsignia } from "./ProfileInsignia";
|
|
|
|
|
import { ProfileHonor } from "./ProfileHonor";
|
|
|
|
|
import { ProfileAssessment } from "./ProfileAssessment";
|
|
|
|
|
import { ProfileLeave } from "./ProfileLeave";
|
|
|
|
|
import { ProfileAbility } from "./ProfileAbility";
|
|
|
|
|
import { ProfileDuty } from "./ProfileDuty";
|
|
|
|
|
import { ProfileNopaid } from "./ProfileNopaid";
|
|
|
|
|
import { ProfileOther } from "./ProfileOther";
|
|
|
|
|
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 {
|
|
|
|
|
@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,
|
|
|
|
|
// length: 40,
|
|
|
|
|
// comment:
|
|
|
|
|
// "คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้",
|
|
|
|
|
// default: null,
|
|
|
|
|
// unique: false,
|
|
|
|
|
// })
|
|
|
|
|
// current_holderId: string;
|
|
|
|
|
|
|
|
|
|
// @Column({
|
|
|
|
|
// nullable: true,
|
|
|
|
|
// length: 40,
|
|
|
|
|
// comment:
|
|
|
|
|
// "คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย",
|
|
|
|
|
// default: null,
|
|
|
|
|
// unique: false,
|
|
|
|
|
// })
|
|
|
|
|
// next_holderId: 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-15 14:32:08 +07:00
|
|
|
@OneToMany(() => EmployeePosMaster, (posMaster) => posMaster.current_holder)
|
|
|
|
|
current_holders: EmployeePosMaster[];
|
|
|
|
|
|
|
|
|
|
@OneToMany(() => EmployeePosMaster, (posMaster) => posMaster.next_holder)
|
|
|
|
|
next_holders: EmployeePosMaster[];
|
|
|
|
|
|
2024-03-16 12:05:45 +07:00
|
|
|
@OneToMany(() => ProfileSalaryEmployee, (profileSalary) => profileSalary.profile)
|
|
|
|
|
profileSalary: ProfileSalaryEmployee[];
|
2024-03-15 14:32:08 +07:00
|
|
|
|
2024-03-16 12:05:45 +07:00
|
|
|
@OneToMany(() => ProfileDisciplineEmployee, (profileDiscipline) => profileDiscipline.profile)
|
|
|
|
|
profileDiscipline: ProfileDisciplineEmployee[];
|
2024-03-15 14:32:08 +07:00
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileCertificate, (profileCertificate) => profileCertificate.profile)
|
|
|
|
|
// profileCertificates: ProfileCertificate[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileEducation, (profileEducation) => profileEducation.profile)
|
|
|
|
|
// profileEducations: ProfileEducation[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileTraining, (profileTraining) => profileTraining.profile)
|
|
|
|
|
// profileTrainings: ProfileTraining[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileInsignia, (profileInsignia) => profileInsignia.profile)
|
|
|
|
|
// profileInsignias: ProfileInsignia[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileHonor, (profileHonor) => profileHonor.profile)
|
|
|
|
|
// profileHonors: ProfileHonor[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileAssessment, (profileAssessment) => profileAssessment.profile)
|
|
|
|
|
// profileAssessments: ProfileAssessment[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileLeave, (profileLeave) => profileLeave.profile)
|
|
|
|
|
// profileLeaves: ProfileLeave[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileAbility, (profileAbility) => profileAbility.profile)
|
|
|
|
|
// profileAbilities: ProfileAbility[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileDuty, (profileDuty) => profileDuty.profile)
|
|
|
|
|
// profileDutys: ProfileDuty[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileNopaid, (profileNopaid) => profileNopaid.profile)
|
|
|
|
|
// profileNopaids: ProfileNopaid[];
|
|
|
|
|
|
|
|
|
|
// @OneToMany(() => ProfileOther, (profileOther) => profileOther.profile)
|
|
|
|
|
// profileOthers: ProfileOther[];
|
|
|
|
|
|
|
|
|
|
@ManyToOne(() => EmployeePosLevel, (posLevel) => posLevel.profiles)
|
|
|
|
|
@JoinColumn({ name: "posLevelId" })
|
|
|
|
|
posLevel: EmployeePosLevel;
|
|
|
|
|
|
|
|
|
|
@ManyToOne(() => EmployeePosType, (posType) => posType.profiles)
|
|
|
|
|
@JoinColumn({ name: "posTypeId" })
|
|
|
|
|
posType: EmployeePosType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class CreateProfileEmployee {
|
|
|
|
|
@Column()
|
|
|
|
|
prefix: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
firstName: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
lastName: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
citizenId: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
position: string;
|
|
|
|
|
|
|
|
|
|
@Column("uuid")
|
|
|
|
|
posLevelId: string | null;
|
|
|
|
|
|
|
|
|
|
@Column("uuid")
|
|
|
|
|
posTypeId: string | null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateProfileEmployee = Partial<CreateProfileEmployee>;
|