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

74 lines
1.8 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { EmployeePosType } from "./EmployeePosType";
import { EmployeePosLevel } from "./EmployeePosLevel";
import { EmployeePosMaster } from "./EmployeePosMaster";
@Entity("employeePosition")
export class EmployeePosition extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อตำแหน่ง",
length: 255,
default: null,
})
positionName: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง employeePosType",
})
posTypeId: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง employeePosLevel",
})
posLevelId: string;
@Column({
comment: "เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?",
default: false,
})
positionIsSelected: boolean;
@Column({
length: 40,
comment: "เชื่อมโยงกับตารางเลขที่ตำแหน่ง",
})
posMasterId: string;
@ManyToOne(() => EmployeePosMaster, (posMaster) => posMaster)
@JoinColumn({ name: "posMasterId" })
posMaster: EmployeePosMaster;
@ManyToOne(() => EmployeePosType, (posType) => posType)
@JoinColumn({ name: "posTypeId" })
posType: EmployeePosType;
@ManyToOne(() => EmployeePosLevel, (posLevel) => posLevel)
@JoinColumn({ name: "posLevelId" })
posLevel: EmployeePosLevel;
}
export class CreateEmployeePosition {
@Column()
positionName: string | null;
@Column("uuid")
posTypeId: string | null;
@Column("uuid")
posLevelId: string | null;
}
export class UpdateEmployeePosition {
@Column()
positionName: string;
@Column("uuid")
posTypeId: string;
@Column("uuid")
posLevelId: string;
}