hrms-api-org/src/entities/EmployeePosDict.ts
2024-03-12 12:14:18 +07:00

57 lines
No EOL
1.4 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, } from "typeorm";
import { EntityBase } from "./base/Base";
import { EmployeePosType } from "./EmployeePosType";
import { EmployeePosLevel } from "./EmployeePosLevel";
@Entity("employeePosDict")
export class EmployeePosDict extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อตำแหน่ง",
length: 255,
default: null,
})
posDictName: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง employeePosType",
})
employeePosTypeId: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง employeePosLevel",
})
employeePosLevelId: string;
@ManyToOne(() => EmployeePosType, (employeePosType) => employeePosType)
@JoinColumn({ name: "employeePosTypeId" })
employeePosType: EmployeePosType;
@ManyToOne(() => EmployeePosLevel, (employeePosLevel) => employeePosLevel)
@JoinColumn({ name: "employeePosLevelId" })
employeePosLevel: EmployeePosLevel;
}
export class CreateEmployeePosDict {
@Column()
posDictName: string | null;
@Column("uuid")
employeePosTypeId: string | null;
@Column("uuid")
employeePosLevelId: string | null;
}
export class UpdateEmployeePosDict {
@Column()
posDictName: string;
@Column("uuid")
employeePosTypeId: string;
@Column("uuid")
employeePosLevelId: string;
}