hrms-api-org/src/entities/Position.ts
2024-02-20 17:09:11 +07:00

122 lines
2.7 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosMaster } from "./PosMaster";
import { PosLevel } from "./PosLevel";
import { PosType } from "./PosType";
import { PosExecutive } from "./PosExecutive";
@Entity("position")
export class Position extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)",
length: 255,
default: null,
})
positionName: string;
@Column({
nullable: true,
comment: "สายงาน",
length: 45,
default: null,
})
positionField: string;
@Column({
length: 40,
comment: "ประเภทตำแหน่ง",
})
posTypeId: string;
@Column({
length: 40,
comment: "ระดับตำแหน่ง",
})
posLevelId: string;
@Column({
nullable: true,
length: 40,
comment: "ตำแหน่งทางการบริหาร",
default: null,
})
posExecutiveId: string | null;
@Column({
nullable: true,
comment: "ด้านทางการบริหาร",
length: 255,
default: null,
})
positionExecutiveField?: string;
@Column({
nullable: true,
comment: "ด้าน/สาขา",
length: 255,
default: null,
})
positionArea?: string;
@Column({
comment: "เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?",
default: false,
})
positionIsSelected: boolean;
@Column({
length: 40,
comment: "เชื่อมโยงกับตารางเลขที่ตำแหน่ง",
})
posMasterId: string;
@Column({
comment: "ฉ",
default: false,
})
isSpecial: boolean;
@ManyToOne(() => PosMaster, (posMaster) => posMaster)
@JoinColumn({ name: "posMasterId" })
posMaster: PosMaster;
@ManyToOne(() => PosExecutive, (posExecutive) => posExecutive)
@JoinColumn({ name: "posExecutiveId" })
posExecutive: PosExecutive;
@ManyToOne(() => PosType, (posType) => posType)
@JoinColumn({ name: "posTypeId" })
posType: PosType;
@ManyToOne(() => PosLevel, (posLevel) => posLevel)
@JoinColumn({ name: "posLevelId" })
posLevel: PosLevel;
}
export class CreatePosition {
@Column()
positionName: string;
@Column()
positionField: string;
@Column()
posTypeId: string;
@Column()
posLevelId: string;
@Column()
posExecutiveId: string;
@Column()
positionExecutiveField: string;
@Column()
positionArea: string;
@Column()
isSpecial: boolean;
}
export type UpdatePosition = Partial<CreatePosition>;