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

57 lines
1.3 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",
})
posTypeId: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง employeePosLevel",
})
posLevelId: string;
@ManyToOne(() => EmployeePosType, (posType) => posType)
@JoinColumn({ name: "posTypeId" })
posType: EmployeePosType;
@ManyToOne(() => EmployeePosLevel, (posLevel) => posLevel)
@JoinColumn({ name: "posLevelId" })
posLevel: EmployeePosLevel;
}
export class CreateEmployeePosDict {
@Column()
posDictName: string | null;
@Column("uuid")
posTypeId: string | null;
@Column("uuid")
posLevelId: string | null;
}
export class UpdateEmployeePosDict {
@Column()
posDictName: string;
@Column("uuid")
posTypeId: string;
@Column("uuid")
posLevelId: string;
}