import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } 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; @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; @Column() posDictField: string; @Column() posTypeId: string; @Column() posLevelId: string; @Column() posExecutiveId: string | null; @Column() posDictExecutiveField: string | null; @Column() posDictArea: string | null; } export type UpdatePosDict = Partial;