hrms-api-org/src/entities/PosDict.ts
2024-10-18 11:52:35 +07:00

161 lines
3 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosExecutive } from "./PosExecutive";
import { PosType } from "./PosType";
import { PosLevel } from "./PosLevel";
@Entity("posDict")
export class PosDict extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)",
length: 255,
default: null,
})
posDictName: string;
@Column({
nullable: true,
comment: "สายงาน",
length: 255,
default: null,
})
posDictField: 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,
length: 255,
comment: "ด้านทางการบริหาร",
default: null,
})
posDictExecutiveField: string;
@Column({
nullable: true,
length: 255,
comment: "ด้าน/สาขา",
default: null,
})
posDictArea: string;
@Column({
comment: "ฉ",
default: false,
})
isSpecial: boolean;
@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 CreatePosDict {
@Column()
posDictName: string | null;
@Column()
posDictField: string | null;
@Column("uuid")
posTypeId: string | null;
@Column("uuid")
posLevelId: string | null;
@Column()
posExecutiveId?: string | null;
@Column()
posDictExecutiveField?: string | null;
@Column()
posDictArea?: string | null;
@Column()
isSpecial: boolean;
@Column()
positionIsSelected?: boolean | null;
}
export class CreatePosDictExe {
@Column()
posDictName: string | null;
@Column()
posDictField: string | null;
@Column("uuid")
posTypeId: string | null;
@Column("uuid")
posLevelId: string | null;
@Column()
posExecutive?: string;
@Column()
posDictExecutiveField: string | null;
@Column()
posDictArea: string | null;
@Column()
isSpecial: boolean;
}
export class UpdatePosDict {
@Column()
posDictName: string;
@Column()
posDictField: string;
@Column("uuid")
posTypeId: string;
@Column("uuid")
posLevelId: string;
@Column()
posExecutiveId?: string | null;
@Column()
posDictExecutiveField?: string | null;
@Column()
posDictArea?: string | null;
@Column()
isSpecial: boolean;
}
// export type UpdatePosDict = Partial<CreatePosDict>;