527 lines
13 KiB
TypeScript
527 lines
13 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 { ProfileSalary } from "./ProfileSalary";
|
|
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 { ProfileFamilyHistory } from "./ProfileFamily";
|
|
import { ProfileEducation } from "./ProfileEducation";
|
|
import { ProfileAbility } from "./ProfileAbility";
|
|
import { ProfileOther } from "./ProfileOther";
|
|
import { ProfileAvatar } from "./ProfileAvatar";
|
|
import { ProfileGovernment } from "./ProfileGovernment";
|
|
import { ProfileFamilyFather } from "./ProfileFamilyFather";
|
|
import { ProfileFamilyMother } from "./ProfileFamilyMother";
|
|
import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
|
|
|
|
import { ProfileChildren } from "./ProfileChildren";
|
|
import { Profile, ProfileAddressHistory } from "./Profile";
|
|
import { Province } from "./Province";
|
|
import { District } from "./District";
|
|
import { SubDistrict } from "./SubDistrict";
|
|
@Entity("profileEmployee")
|
|
export class ProfileEmployee extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
comment: "รูปถ่าย",
|
|
default: null,
|
|
})
|
|
avatar: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "รูปถ่าย",
|
|
default: null,
|
|
})
|
|
avatarName: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
type: "datetime",
|
|
comment: "วันที่บรรจุ",
|
|
default: null,
|
|
})
|
|
dateAppoint: Date;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
type: "datetime",
|
|
comment: "วันที่เริ่มปฏิบัติราชการ",
|
|
default: null,
|
|
})
|
|
dateStart: Date;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ขาดราชการ",
|
|
default: null,
|
|
})
|
|
govAgeAbsent: number;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "อายุราชการเกื้อกูล",
|
|
default: null,
|
|
})
|
|
govAgePlus: number;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เหตุผลกรณีวันไม่ตรงกัน",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
reasonSameDate: 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({
|
|
nullable: true,
|
|
type: "datetime",
|
|
comment: "วันที่เกษียณอายุราชการตามกฏหมาย",
|
|
default: null,
|
|
})
|
|
dateRetireLaw: 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: 255,
|
|
default: null,
|
|
})
|
|
nationality: 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(() => ProfileSalary, (v) => v.profileEmployee)
|
|
profileSalarys: ProfileSalary[];
|
|
|
|
@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[];
|
|
|
|
@OneToMany(() => ProfileAddressHistory, (v) => v.profileEmployee)
|
|
profileAddressHistories: ProfileAddressHistory[];
|
|
|
|
@OneToMany(() => ProfileGovernment, (v) => v.profileEmployee)
|
|
profileGovernment: ProfileGovernment[];
|
|
|
|
@OneToMany(() => ProfileFamilyFather, (v) => v.profile)
|
|
profileFamilyFather: ProfileFamilyFather[];
|
|
|
|
@OneToMany(() => ProfileFamilyMother, (v) => v.profile)
|
|
profileFamilyMother: ProfileFamilyMother[];
|
|
|
|
@OneToMany(() => ProfileFamilyCouple, (v) => v.profile)
|
|
profileFamilyCouple: ProfileFamilyCouple[];
|
|
|
|
//ที่อยู่
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ที่อยู่ตามทะเบียนบ้าน",
|
|
default: null,
|
|
length: 255,
|
|
})
|
|
registrationAddress: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "จังหวัดตามทะเบียนบ้าน",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
registrationProvinceId: string;
|
|
|
|
@ManyToOne(() => Province, (v) => v.registrationProvinces)
|
|
registrationProvince: Province;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เขตตามทะเบียนบ้าน",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
registrationDistrictId: string;
|
|
|
|
@ManyToOne(() => District, (v) => v.registrationDistricts)
|
|
registrationDistrict: District;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "แขวงตามทะเบียนบ้าน",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
registrationSubDistrictId: string;
|
|
|
|
@ManyToOne(() => SubDistrict, (v) => v.registrationSubDistricts)
|
|
registrationSubDistrict: SubDistrict;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "รหัสไปรษณีย์ตามทะเบียนบ้าน",
|
|
default: null,
|
|
length: 5,
|
|
})
|
|
registrationZipCode: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ที่อยู่ตามปัจจุบัน",
|
|
default: null,
|
|
length: 255,
|
|
})
|
|
currentAddress: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "จังหวัดตามปัจจุบัน",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
currentProvinceId: string;
|
|
|
|
@ManyToOne(() => Province, (v) => v.currentProvinces)
|
|
currentProvince: Province;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เขตตามปัจจุบัน",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
currentDistrictId: string;
|
|
|
|
@ManyToOne(() => District, (v) => v.currentDistricts)
|
|
currentDistrict: District;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "แขวงตามปัจจุบัน",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
currentSubDistrictId: string;
|
|
|
|
@ManyToOne(() => SubDistrict, (v) => v.currentSubDistricts)
|
|
currentSubDistrict: SubDistrict;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "รหัสไปรษณีย์ตามปัจจุบัน",
|
|
default: null,
|
|
length: 5,
|
|
})
|
|
currentZipCode: string;
|
|
}
|
|
|
|
@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;
|
|
rank?: string | null;
|
|
firstName: string;
|
|
lastName: string;
|
|
citizenId: string;
|
|
birthDate?: Date | null;
|
|
position?: string | null;
|
|
posLevelId?: string | null;
|
|
posTypeId?: string | null;
|
|
gender?: string | null;
|
|
relationship?: string | null;
|
|
nationality?: string | null;
|
|
ethnicity?: string | null;
|
|
religion?: string | null;
|
|
bloodGroup?: string | null;
|
|
phone?: string | null;
|
|
salaryLevel?: number | null;
|
|
employeeClass?: string | null;
|
|
}
|
|
|
|
export type UpdateProfileEmployee = {
|
|
prefix: string;
|
|
rank?: string | null;
|
|
firstName: string;
|
|
lastName: string;
|
|
citizenId: string;
|
|
birthDate?: Date | null;
|
|
position?: string | null;
|
|
posLevelId?: string | null;
|
|
posTypeId?: string | null;
|
|
gender?: string | null;
|
|
relationship?: string | null;
|
|
nationality?: string | null;
|
|
ethnicity?: string | null;
|
|
religion?: string | null;
|
|
bloodGroup?: string | null;
|
|
phone?: string | null;
|
|
salaryLevel?: number | null;
|
|
employeeClass?: string | null;
|
|
};
|
|
|
|
export type UpdateProfileAddressEmployee = {
|
|
registrationAddress?: string | null;
|
|
registrationProvinceId?: string | null;
|
|
registrationDistrictId?: string | null;
|
|
registrationSubDistrictId?: string | null;
|
|
registrationZipCode?: string | null;
|
|
currentAddress?: string | null;
|
|
currentProvinceId?: string | null;
|
|
currentDistrictId?: string | null;
|
|
currentSubDistrictId?: string | null;
|
|
currentZipCode?: string | null;
|
|
};
|