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 { ProfileCertificate } from "./ProfileCertificate"; import { ProfileTraining } from "./ProfileTraining"; import { ProfileInsignia } from "./ProfileInsignia"; import { ProfileHonor } from "./ProfileHonor"; import { ProfileAssessment } from "./ProfileAssessment"; import { ProfileLeave } from "./ProfileLeave"; import { ProfileDuty } from "./ProfileDuty"; import { ProfileNopaid } from "./ProfileNopaid"; import { ProfileDiscipline } from "./ProfileDiscipline"; import { ProfileChangeName } from "./ProfileChangeName"; import { ProfileChildren, ProfileFamilyHistory } from "./ProfileFamily"; import { ProfileEducation } from "./ProfileEducation"; import { ProfileAbility } from "./ProfileAbility"; import { ProfileOther } from "./ProfileOther"; import { ProfileAvatar } from "./ProfileAvatar"; @Entity("profileEmployee") export class ProfileEmployee extends EntityBase { @Column({ nullable: true, comment: "รูปถ่าย", default: null, }) avatar: string; @Column({ nullable: true, comment: "ประเภทลูกจ้าง (perm->ลูกจ้างประจำ temp->ลูกจ้างชั่วคราว)", length: 40, default: null, }) employeeClass: string; @Column({ nullable: true, comment: "ยศ", length: 40, default: null, }) rank: string; @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: "กลุ่มบัญชีการจ้าง", default: null, }) group: number; @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, }) gender: string; @Column({ nullable: true, comment: "ความสัมพันธ์", length: 40, default: null, }) relationship: string; @Column({ nullable: true, comment: "ศาสนา", length: 255, default: null, }) religion: string; @Column({ nullable: true, comment: "กรุ๊ปเลือด", length: 40, default: null, }) bloodGroup: string; @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[]; @OneToMany(() => ProfileCertificate, (v) => v.profileEmployee) profileCertificates: ProfileCertificate[]; @OneToMany(() => ProfileTraining, (v) => v.profileEmployee) profileTrainings: ProfileTraining[]; @OneToMany(() => ProfileInsignia, (v) => v.profileEmployee) profileInsignias: ProfileInsignia[]; @OneToMany(() => ProfileHonor, (v) => v.profileEmployee) profileHonors: ProfileHonor[]; @OneToMany(() => ProfileAssessment, (v) => v.profileEmployee) profileAssessments: ProfileAssessment[]; @OneToMany(() => ProfileLeave, (v) => v.profileEmployee) profileLeaves: ProfileLeave[]; @OneToMany(() => ProfileDuty, (v) => v.profileEmployee) profileDutys: ProfileDuty[]; @OneToMany(() => ProfileNopaid, (v) => v.profileEmployee) profileNopaids: ProfileNopaid[]; @OneToMany(() => ProfileDiscipline, (v) => v.profileEmployee) profileDisciplines: ProfileDiscipline[]; @OneToMany(() => ProfileChangeName, (v) => v.profileEmployee) profileChangeNames: ProfileChangeName[]; @OneToMany(() => ProfileFamilyHistory, (v) => v.profileEmployee) profileFamilys: ProfileFamilyHistory[]; @OneToMany(() => ProfileChildren, (v) => v.profileEmployee) profileChildrens: ProfileChildren[]; @OneToMany(() => ProfileEducation, (v) => v.profileEmployee) profileEducations: ProfileEducation[]; @OneToMany(() => ProfileAbility, (v) => v.profileEmployee) profileAbilities: ProfileAbility[]; @OneToMany(() => ProfileOther, (v) => v.profileEmployee) profileOthers: ProfileOther[]; @OneToMany(() => ProfileAvatar, (v) => v.profileEmployee) profileAvatars: ProfileAvatar[]; @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 { rank: string; 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; religion: string | null; posLevelId: string | null; posTypeId: string | null; gender: string | null; relationship: string | null; bloodGroup: string | null; email: string | null; phone: string | null; } export type UpdateProfileEmployee = { rank?: string | null; 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; religion: string | null; posLevelId?: string | null; posTypeId?: string | null; gender?: string | null; relationship?: string | null; bloodGroup?: string | null; email: string | null; phone: string | null; };