import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { PosType } from "./PosType"; import { Position } from "./Position"; import { PosDict } from "./PosDict"; import { Profile } from "./Profile"; import { profile } from "console"; enum PosLevelAuthority { HEAD = "HEAD", DEPUTY = "DEPUTY", GOVERNOR = "GOVERNOR", } @Entity("posLevel") export class PosLevel extends EntityBase { @Column({ nullable: true, comment: "ชื่อระดับตำแหน่ง", length: 255, default: null, }) posLevelName: string; @Column({ nullable: true, comment: "ระดับของระดับตำแหน่ง", default: null, }) posLevelRank: number; @Column({ nullable: true, comment: "ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ", type: "enum", enum: PosLevelAuthority, default: null, }) posLevelAuthority: PosLevelAuthority; @Column({ length: 40, comment: "เป็นระดับของประเภทตำแหน่งใด", }) posTypeId: string; @ManyToOne(() => PosType, (posType) => posType.posLevels) @JoinColumn({ name: "posTypeId" }) posType: PosType; @OneToMany(() => Position, (position) => position.posLevel) positions: Position[]; @OneToMany(() => PosDict, (posDict) => posDict.posLevel) posDicts: PosDict[]; @OneToMany(() => Profile, (profile) => profile.posLevel) profiles: Profile[]; } export class CreatePosLevel { @Column() posLevelName: string; @Column() posLevelRank: number; @Column() posLevelAuthority: string; @Column("uuid") posTypeId: string; } export type UpdatePosLevel = Partial & { posLevelAuthority?: PosLevelAuthority };