hrms-api-org/src/entities/ProfileEmployee.ts

859 lines
20 KiB
TypeScript
Raw Normal View History

2024-03-21 11:28:02 +07:00
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";
2024-05-13 15:06:52 +07:00
import { ProfileCertificate } from "./ProfileCertificate";
import { ProfileTraining } from "./ProfileTraining";
import { ProfileInsignia } from "./ProfileInsignia";
import { ProfileHonor } from "./ProfileHonor";
import { ProfileAssessment } from "./ProfileAssessment";
2024-05-13 16:37:51 +07:00
import { ProfileLeave } from "./ProfileLeave";
import { ProfileDuty } from "./ProfileDuty";
import { ProfileNopaid } from "./ProfileNopaid";
import { ProfileDiscipline } from "./ProfileDiscipline";
2024-05-13 17:21:19 +07:00
import { ProfileChangeName } from "./ProfileChangeName";
2024-05-14 17:26:06 +07:00
import { ProfileFamilyHistory } from "./ProfileFamily";
2024-05-13 17:21:19 +07:00
import { ProfileEducation } from "./ProfileEducation";
import { ProfileAbility } from "./ProfileAbility";
2024-05-13 17:38:21 +07:00
import { ProfileOther } from "./ProfileOther";
2024-05-14 15:29:05 +07:00
import { ProfileAvatar } from "./ProfileAvatar";
2024-05-14 16:20:18 +07:00
import { ProfileGovernment } from "./ProfileGovernment";
2024-05-14 17:39:32 +07:00
import { ProfileFamilyFather } from "./ProfileFamilyFather";
import { ProfileFamilyMother } from "./ProfileFamilyMother";
import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
2024-05-14 17:26:06 +07:00
import { ProfileChildren } from "./ProfileChildren";
2024-05-16 10:32:51 +07:00
import { Profile, ProfileAddressHistory } from "./Profile";
import { Province } from "./Province";
import { District } from "./District";
import { SubDistrict } from "./SubDistrict";
2024-07-19 11:08:47 +07:00
import { ProfileEmployeeInformationHistory } from "./ProfileEmployeeInformationHistory";
import { ProfileEmployeeEmployment } from "./ProfileEmployeeEmployment";
import { ProfileEdit } from "./ProfileEdit";
2024-08-27 09:21:22 +07:00
import { ProfileDevelopment } from "./ProfileDevelopment";
2024-06-07 12:59:55 +07:00
@Entity("profileEmployee")
export class ProfileEmployee extends EntityBase {
2024-05-14 15:29:05 +07:00
@Column({
nullable: true,
comment: "รูปถ่าย",
default: null,
})
avatar: string;
2024-05-16 12:13:46 +07:00
@Column({
nullable: true,
comment: "รูปถ่าย",
default: null,
})
avatarName: string;
2024-05-17 14:21:53 +07:00
@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;
2024-06-07 03:05:57 +07:00
@Column({
comment: "เกษียณ",
default: false,
})
isLeave: boolean;
@Column({
nullable: true,
comment: "เหตุผลเกษียณ",
default: null,
})
leaveReason: string;
@Column({
nullable: true,
type: "datetime",
comment: "วันพ้นราชการ",
default: null,
})
dateLeave: Date;
@Column({
nullable: true,
type: "datetime",
2024-05-14 17:54:17 +07:00
comment: "วันครบเกษียณอายุ",
default: null,
})
dateRetire: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วันเกิด",
default: null,
})
birthDate: Date;
2024-05-14 17:54:17 +07:00
@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;
2024-03-21 11:28:02 +07:00
@Column({
nullable: true,
comment: "เชื้อชาติ",
length: 255,
default: null,
})
ethnicity: string;
2024-03-21 11:28:02 +07:00
@Column({
nullable: true,
comment: "เบอร์โทร",
length: 255,
default: null,
})
telephoneNumber: string;
2024-05-17 09:50:19 +07:00
@Column({
nullable: true,
comment: "สัญชาติ",
length: 255,
default: null,
})
nationality: string;
2024-03-21 11:28:02 +07:00
@Column({
nullable: true,
comment: "เพศ",
length: 40,
default: null,
})
gender: string;
2024-03-21 11:28:02 +07:00
@Column({
nullable: true,
comment: "ความสัมพันธ์",
length: 40,
default: null,
})
relationship: string;
2024-03-21 16:29:51 +07:00
@Column({
nullable: true,
comment: "ศาสนา",
length: 255,
default: null,
})
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,
})
bloodGroup: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "id อัตรา",
default: null,
})
posmasterIdTemp: string;
@Column({
nullable: true,
comment: "node",
default: null,
})
nodeTemp: string;
@Column({
nullable: true,
comment: "id node",
default: null,
})
nodeIdTemp: string;
@Column({
nullable: true,
comment: "id Revision",
default: null,
})
orgRevisionIdTemp: string;
@Column({
nullable: true,
comment: "id position",
default: null,
})
positionIdTemp: string;
@Column({
nullable: true,
comment: "เลขที่ตำแหน่ง",
default: null,
})
posMasterNoTemp: string;
@Column({
nullable: true,
comment: "ตำแหน่ง",
default: null,
})
positionTemp: string;
@Column({
nullable: true,
comment: "ตำแหน่ง",
default: null,
})
positionFieldTemp: string;
@Column({
nullable: true,
comment: "id ประเภท",
default: null,
})
posTypeIdTemp: string;
@Column({
nullable: true,
comment: "ประเภท",
default: null,
})
posTypeNameTemp: string;
@Column({
nullable: true,
comment: "id ระดับ",
default: null,
})
posLevelIdTemp: string;
@Column({
nullable: true,
comment: "ระดับ",
default: null,
})
posLevelNameTemp: string;
@Column({
nullable: true,
comment: "ชื่อ root",
default: null,
})
rootTemp: string;
@Column({
nullable: true,
comment: "id root",
default: null,
})
2024-06-06 14:16:00 +07:00
rootIdTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อย่อ root",
default: null,
})
2024-06-06 14:16:00 +07:00
rootShortNameTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อ child1",
default: null,
})
child1Temp: string;
@Column({
nullable: true,
comment: "id child1",
default: null,
})
2024-06-06 14:16:00 +07:00
child1IdTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อย่อ child1",
default: null,
})
2024-06-06 14:16:00 +07:00
child1ShortNameTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อ child2",
default: null,
})
child2Temp: string;
@Column({
nullable: true,
comment: "id child2",
default: null,
})
2024-06-06 14:16:00 +07:00
child2IdTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อย่อ child2",
default: null,
})
2024-06-06 14:16:00 +07:00
child2ShortNameTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อ child3",
default: null,
})
child3Temp: string;
@Column({
nullable: true,
comment: "id child3",
default: null,
})
2024-06-06 14:16:00 +07:00
child3IdTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อย่อ child3",
default: null,
})
2024-06-06 14:16:00 +07:00
child3ShortNameTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อ child4",
default: null,
})
child4Temp: string;
@Column({
nullable: true,
comment: "id child4",
default: null,
})
2024-06-06 14:16:00 +07:00
child4IdTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "ชื่อย่อ child4",
default: null,
})
2024-06-06 14:16:00 +07:00
child4ShortNameTemp: string;
@Column({
nullable: true,
comment: "สถานะลูกจ้างชั่วคราว",
2024-06-06 14:16:00 +07:00
default: null,
})
statusTemp: string;
2024-06-06 14:11:49 +07:00
@Column({
nullable: true,
comment: "กลุ่มงาน",
default: null,
})
positionEmployeeGroupId: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "สายงาน",
default: null,
})
positionEmployeeLineId: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "ชื่อตำแหน่งทางสายงาน",
default: null,
})
positionEmployeePositionId: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "สังกัด",
default: null,
})
employeeOc: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "ประเภทบุคคล",
default: null,
})
employeeTypeIndividual: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "ค่าจ้าง",
default: null,
})
employeeWage: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "เงินเพิ่มการครองชีพชั่วคราว",
default: null,
})
employeeMoneyIncrease: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "เงินช่วยเหลือการครองชีพชั่วคราว",
default: null,
})
employeeMoneyAllowance: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "เงินสมทบประกันสังคม(ลูกจ้าง)",
default: null,
})
employeeMoneyEmployee: string;
2024-07-19 11:08:47 +07:00
@Column({
nullable: true,
comment: "เงินสมทบประกันสังคม(นายจ้าง)",
default: null,
})
employeeMoneyEmployer: string;
2024-07-19 11:08:47 +07:00
2024-06-07 10:50:31 +07:00
@OneToMany(() => ProfileEmployeeInformationHistory, (v) => v.profileEmployeeInformation)
information_histories: ProfileEmployeeInformationHistory[];
2024-06-07 12:59:55 +07:00
@OneToMany(() => ProfileEmployeeEmployment, (v) => v.profileEmployee)
profileEmployeeEmployment: ProfileEmployeeEmployment[];
2024-03-21 11:28:02 +07:00
@OneToMany(() => EmployeePosMaster, (v) => v.current_holder)
current_holders: EmployeePosMaster[];
2024-03-21 11:28:02 +07:00
@OneToMany(() => EmployeePosMaster, (v) => v.next_holder)
next_holders: EmployeePosMaster[];
@OneToMany(() => ProfileSalary, (v) => v.profileEmployee)
profileSalarys: ProfileSalary[];
2024-05-13 15:06:52 +07:00
@OneToMany(() => ProfileCertificate, (v) => v.profileEmployee)
profileCertificates: ProfileCertificate[];
2024-07-19 11:08:47 +07:00
2024-05-13 15:06:52 +07:00
@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[];
2024-05-13 16:37:51 +07:00
@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)
2024-05-14 16:16:24 +07:00
profileDisciplines: ProfileDiscipline[];
2024-05-13 16:37:51 +07:00
2024-05-13 17:21:19 +07:00
@OneToMany(() => ProfileChangeName, (v) => v.profileEmployee)
profileChangeNames: ProfileChangeName[];
@OneToMany(() => ProfileFamilyHistory, (v) => v.profileEmployee)
profileFamilys: ProfileFamilyHistory[];
2024-05-14 10:29:05 +07:00
@OneToMany(() => ProfileChildren, (v) => v.profileEmployee)
profileChildrens: ProfileChildren[];
2024-05-13 17:21:19 +07:00
@OneToMany(() => ProfileEducation, (v) => v.profileEmployee)
profileEducations: ProfileEducation[];
@OneToMany(() => ProfileAbility, (v) => v.profileEmployee)
profileAbilities: ProfileAbility[];
2024-05-13 17:38:21 +07:00
@OneToMany(() => ProfileOther, (v) => v.profileEmployee)
profileOthers: ProfileOther[];
2024-08-27 09:21:22 +07:00
@OneToMany(() => ProfileDevelopment, (v) => v.profileEmployee)
profileDevelopments: ProfileDevelopment[];
2024-05-14 15:29:05 +07:00
@OneToMany(() => ProfileAvatar, (v) => v.profileEmployee)
profileAvatars: ProfileAvatar[];
2024-07-19 11:08:47 +07:00
@OneToMany(() => ProfileEdit, (v) => v.profileEmployee)
profileEdits: ProfileEdit[];
2024-03-21 11:28:02 +07:00
@ManyToOne(() => EmployeePosLevel, (v) => v.profiles)
posLevel: EmployeePosLevel;
2024-03-21 11:28:02 +07:00
@ManyToOne(() => EmployeePosType, (v) => v.profiles)
posType: EmployeePosType;
2024-03-21 11:28:02 +07:00
@OneToMany(() => ProfileEmployeeHistory, (v) => v.profileEmployee)
histories: ProfileEmployeeHistory[];
2024-05-14 16:20:18 +07:00
2024-05-16 10:32:51 +07:00
@OneToMany(() => ProfileAddressHistory, (v) => v.profileEmployee)
profileAddressHistories: ProfileAddressHistory[];
2024-05-14 16:20:18 +07:00
@OneToMany(() => ProfileGovernment, (v) => v.profileEmployee)
profileGovernment: ProfileGovernment[];
2024-05-14 17:39:32 +07:00
@OneToMany(() => ProfileFamilyFather, (v) => v.profile)
profileFamilyFather: ProfileFamilyFather[];
@OneToMany(() => ProfileFamilyMother, (v) => v.profile)
profileFamilyMother: ProfileFamilyMother[];
2024-05-14 17:54:17 +07:00
@OneToMany(() => ProfileFamilyCouple, (v) => v.profile)
2024-05-14 17:39:32 +07:00
profileFamilyCouple: ProfileFamilyCouple[];
2024-05-16 10:32:51 +07:00
//ที่อยู่
@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;
2024-03-21 11:28:02 +07:00
}
@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;
2024-03-21 11:28:02 +07:00
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;
2024-06-05 16:27:26 +07:00
salaryLevel?: number | null;
employeeClass?: string | null;
}
2024-06-07 12:59:55 +07:00
export class UpdateInformationProfileEmployee {
positionEmployeeGroupId: string | null;
positionEmployeeLineId: string | null;
positionEmployeePositionId: string | null;
employeeOc?: string | null;
employeeTypeIndividual?: string | null;
employeeWage?: string | null;
employeeMoneyIncrease?: string | null;
employeeMoneyAllowance?: string | null;
employeeMoneyEmployee?: string | null;
employeeMoneyEmployer?: string | null;
}
2024-03-21 11:28:02 +07:00
export type UpdateProfileEmployee = {
prefix: string;
rank?: string | null;
firstName: string;
lastName: string;
citizenId: string;
2024-03-21 11:28:02 +07:00
birthDate?: Date | null;
position?: string | null;
2024-03-21 11:28:02 +07:00
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;
2024-06-05 16:27:26 +07:00
salaryLevel?: number | null;
employeeClass?: string | null;
2024-03-21 11:28:02 +07:00
};
2024-05-16 10:32:51 +07:00
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;
2024-05-16 12:13:46 +07:00
};
export type UpdatePositionTempProfileEmployee = {
2024-06-07 03:05:57 +07:00
posmasterId: string;
node: number;
nodeId: string;
orgRevisionId: string;
positionId: string;
posMasterNo: string;
position: string;
positionField: string;
posTypeId: string | null;
2024-06-07 03:05:57 +07:00
posTypeName: string;
posLevelId: string | null;
2024-06-07 03:05:57 +07:00
posLevelName: string;
};