2024-02-07 11:17:01 +07:00
|
|
|
import { Entity, Column, OneToMany, OneToOne, JoinColumn, ManyToMany, ManyToOne } from "typeorm";
|
2024-02-06 10:12:41 +07:00
|
|
|
import { EntityBase } from "./base/Base";
|
|
|
|
|
import { PosMaster } from "./PosMaster";
|
2024-02-07 11:17:01 +07:00
|
|
|
import { PosLevel } from "./PosLevel";
|
|
|
|
|
import { PosType } from "./PosType";
|
2024-02-23 14:19:39 +07:00
|
|
|
import { ProfileSalary } from "./ProfileSalary";
|
2024-03-08 14:54:24 +07:00
|
|
|
import { ProfileDiscipline } from "./ProfileDiscipline";
|
2024-03-12 14:53:15 +07:00
|
|
|
import { ProfileCertificate } from "./ProfileCertificate";
|
|
|
|
|
import { ProfileEducation } from "./ProfileEducation";
|
|
|
|
|
import { ProfileTraining } from "./ProfileTraining";
|
|
|
|
|
import { ProfileInsignia } from "./ProfileInsignia";
|
|
|
|
|
import { ProfileHonor } from "./ProfileHonor";
|
|
|
|
|
import { ProfileAssessment } from "./ProfileAssessment";
|
2024-03-12 17:33:22 +07:00
|
|
|
import { ProfileLeave } from "./ProfileLeave";
|
2024-03-12 17:52:22 +07:00
|
|
|
import { ProfileAbility } from "./ProfileAbility";
|
2024-03-13 10:43:50 +07:00
|
|
|
import { ProfileDuty } from "./ProfileDutys";
|
|
|
|
|
import { ProfileNopaid } from "./ProfileNopaid";
|
|
|
|
|
import { ProfileOther } from "./ProfileOther";
|
2024-02-06 10:12:41 +07:00
|
|
|
|
|
|
|
|
@Entity("profile")
|
|
|
|
|
export class Profile 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,
|
2024-02-06 15:44:16 +07:00
|
|
|
length: 13,
|
2024-02-06 10:12:41 +07:00
|
|
|
})
|
2024-02-06 11:02:29 +07:00
|
|
|
citizenId: string;
|
2024-02-06 10:12:41 +07:00
|
|
|
|
2024-02-07 11:17:01 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "ตำแหน่ง",
|
|
|
|
|
default: null,
|
|
|
|
|
length: 255,
|
|
|
|
|
})
|
|
|
|
|
position: string;
|
|
|
|
|
|
|
|
|
|
@Column({
|
2024-02-07 11:24:08 +07:00
|
|
|
nullable: true,
|
2024-02-07 11:17:01 +07:00
|
|
|
length: 40,
|
|
|
|
|
comment: "ไอดีระดับตำแหน่ง",
|
|
|
|
|
})
|
2024-02-07 16:36:55 +07:00
|
|
|
posLevelId: string | null;
|
2024-02-07 11:17:01 +07:00
|
|
|
|
|
|
|
|
@Column({
|
2024-02-07 11:24:08 +07:00
|
|
|
nullable: true,
|
2024-02-07 11:17:01 +07:00
|
|
|
length: 40,
|
2024-02-08 09:52:18 +07:00
|
|
|
comment: "ไอดีประเภทตำแหน่ง",
|
2024-02-07 11:17:01 +07:00
|
|
|
})
|
2024-02-07 16:36:55 +07:00
|
|
|
posTypeId: string | null;
|
2024-02-07 11:17:01 +07:00
|
|
|
|
2024-02-16 12:07:37 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
length: 255,
|
|
|
|
|
comment: "อีเมล",
|
|
|
|
|
})
|
|
|
|
|
email: string;
|
|
|
|
|
|
|
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
length: 20,
|
|
|
|
|
comment: "เบอร์โทร",
|
|
|
|
|
})
|
|
|
|
|
phone: string;
|
|
|
|
|
|
2024-02-06 15:44:16 +07:00
|
|
|
// @Column({
|
|
|
|
|
// nullable: true,
|
|
|
|
|
// length: 40,
|
|
|
|
|
// comment:
|
|
|
|
|
// "คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้",
|
|
|
|
|
// default: null,
|
|
|
|
|
// unique: false,
|
|
|
|
|
// })
|
|
|
|
|
// current_holderId: string;
|
2024-02-06 10:12:41 +07:00
|
|
|
|
2024-02-06 15:44:16 +07:00
|
|
|
// @Column({
|
|
|
|
|
// nullable: true,
|
|
|
|
|
// length: 40,
|
|
|
|
|
// comment:
|
|
|
|
|
// "คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย",
|
|
|
|
|
// default: null,
|
|
|
|
|
// unique: false,
|
|
|
|
|
// })
|
|
|
|
|
// next_holderId: string;
|
2024-02-16 12:07:37 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
comment: "id keycloak",
|
|
|
|
|
length: 40,
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
|
|
|
|
keycloak: string;
|
2024-02-06 15:44:16 +07:00
|
|
|
|
2024-02-22 15:44:40 +07:00
|
|
|
@Column({
|
|
|
|
|
comment: "ทดลองปฏิบัติหน้าที่",
|
|
|
|
|
default: false,
|
|
|
|
|
})
|
|
|
|
|
isProbation: boolean;
|
|
|
|
|
|
2024-03-08 14:54:24 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
type: "datetime",
|
|
|
|
|
comment: "วันที่พักราชการ",
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
|
|
|
|
dateRetire: Date;
|
|
|
|
|
|
2024-03-11 14:19:26 +07:00
|
|
|
@Column({
|
|
|
|
|
nullable: true,
|
|
|
|
|
type: "datetime",
|
|
|
|
|
comment: "วันเกิด",
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
|
|
|
|
birthDate: Date;
|
2024-03-12 14:53:15 +07:00
|
|
|
|
2024-02-06 15:44:16 +07:00
|
|
|
@OneToMany(() => PosMaster, (posMaster) => posMaster.current_holder)
|
|
|
|
|
current_holders: PosMaster[];
|
2024-02-06 15:49:02 +07:00
|
|
|
|
2024-02-06 15:44:16 +07:00
|
|
|
@OneToMany(() => PosMaster, (posMaster) => posMaster.next_holder)
|
|
|
|
|
next_holders: PosMaster[];
|
2024-02-07 11:17:01 +07:00
|
|
|
|
2024-02-23 14:19:39 +07:00
|
|
|
@OneToMany(() => ProfileSalary, (profileSalary) => profileSalary.profile)
|
2024-03-08 14:54:24 +07:00
|
|
|
profileSalary: ProfileSalary[];
|
|
|
|
|
|
|
|
|
|
@OneToMany(() => ProfileDiscipline, (profileDiscipline) => profileDiscipline.profile)
|
|
|
|
|
profileDiscipline: ProfileDiscipline[];
|
2024-02-23 14:19:39 +07:00
|
|
|
|
2024-03-12 14:53:15 +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[];
|
|
|
|
|
|
2024-03-12 17:33:22 +07:00
|
|
|
@OneToMany(() => ProfileLeave, (profileLeave) => profileLeave.profile)
|
|
|
|
|
profileLeaves: ProfileLeave[];
|
|
|
|
|
|
2024-03-12 17:52:22 +07:00
|
|
|
@OneToMany(() => ProfileAbility, (profileAbility) => profileAbility.profile)
|
|
|
|
|
profileAbilities: ProfileAbility[];
|
|
|
|
|
|
2024-03-13 10:43:50 +07:00
|
|
|
@OneToMany(() => ProfileDuty, (profileDuty) => profileDuty.profile)
|
|
|
|
|
profileDutys: ProfileDuty[];
|
|
|
|
|
|
|
|
|
|
@OneToMany(() => ProfileNopaid, (profileNopaid) => profileNopaid.profile)
|
|
|
|
|
profileNopaids: ProfileNopaid[];
|
|
|
|
|
|
|
|
|
|
@OneToMany(() => ProfileOther, (profileOther) => profileOther.profile)
|
|
|
|
|
profileOthers: ProfileOther[];
|
|
|
|
|
|
2024-02-07 12:43:49 +07:00
|
|
|
@ManyToOne(() => PosLevel, (posLevel) => posLevel.posLevels)
|
2024-02-07 11:17:01 +07:00
|
|
|
@JoinColumn({ name: "posLevelId" })
|
2024-02-07 12:43:49 +07:00
|
|
|
posLevel: PosLevel;
|
2024-02-07 11:17:01 +07:00
|
|
|
|
2024-02-07 12:43:49 +07:00
|
|
|
@ManyToOne(() => PosType, (posType) => posType.posTypes)
|
2024-02-07 11:17:01 +07:00
|
|
|
@JoinColumn({ name: "posTypeId" })
|
2024-02-07 12:43:49 +07:00
|
|
|
posType: PosType;
|
2024-02-06 10:12:41 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class CreateProfile {
|
|
|
|
|
@Column()
|
|
|
|
|
prefix: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
firstName: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
lastName: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
2024-02-06 11:02:29 +07:00
|
|
|
citizenId: string;
|
2024-02-08 10:56:03 +07:00
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
position: string;
|
|
|
|
|
|
|
|
|
|
@Column("uuid")
|
|
|
|
|
posLevelId: string | null;
|
|
|
|
|
|
|
|
|
|
@Column("uuid")
|
|
|
|
|
posTypeId: string | null;
|
2024-02-06 10:12:41 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateProfile = Partial<CreateProfile>;
|