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

77 lines
1.9 KiB
TypeScript
Raw Normal View History

import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosType } from "./PosType";
2024-01-31 14:29:39 +07:00
import { Position } from "./Position";
import { PosDict } from "./PosDict";
2024-02-07 11:17:01 +07:00
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: "ชื่อระดับตำแหน่ง",
2024-01-30 11:41:38 +07:00
length: 255,
2024-02-01 11:02:35 +07:00
default: null,
})
posLevelName: string;
@Column({
nullable: true,
comment: "ระดับของระดับตำแหน่ง",
2024-02-01 11:02:35 +07:00
default: null,
})
posLevelRank: number;
@Column({
nullable: true,
comment:
"ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ",
type: "enum",
enum: PosLevelAuthority,
2024-02-01 11:02:35 +07:00
default: null,
})
posLevelAuthority: PosLevelAuthority;
@Column({
length: 40,
comment: "เป็นระดับของประเภทตำแหน่งใด",
})
posTypeId: string;
@ManyToOne(() => PosType, (posType) => posType.posLevels)
@JoinColumn({ name: "posTypeId" })
posType: PosType;
2024-01-31 14:29:39 +07:00
@OneToMany(() => Position, (position) => position.posLevel)
positions: Position[];
@OneToMany(() => PosDict, (posDict) => posDict.posLevel)
posDicts: PosDict[];
2024-02-07 11:17:01 +07:00
@OneToMany(() => Profile, (profile) => profile.posLevelsId)
posLevelId: Profile;
}
2024-01-31 16:15:55 +07:00
export class CreatePosLevel {
@Column()
posLevelName: string;
@Column()
posLevelRank: number;
@Column()
posLevelAuthority: string;
@Column("uuid")
posTypeId: string;
}
export type UpdatePosLevel = Partial<CreatePosLevel> & { posLevelAuthority?: PosLevelAuthority };