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

114 lines
2.5 KiB
TypeScript
Raw Normal View History

import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
2024-01-31 14:29:39 +07:00
import { PosMaster } from "./PosMaster";
import { PosLevel } from "./PosLevel";
import { PosType } from "./PosType";
import { PosExecutive } from "./PosExecutive";
@Entity("position")
export class Position extends EntityBase {
2024-01-30 16:02:34 +07:00
@Column({
nullable: true,
comment: "ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)",
length: 255,
2024-02-01 11:02:35 +07:00
default: null,
2024-01-30 16:02:34 +07:00
})
positionName: string;
@Column({
nullable: true,
comment: "สายงาน",
length: 45,
2024-02-01 11:02:35 +07:00
default: null,
2024-01-30 16:02:34 +07:00
})
positionField: string;
@Column({
length: 40,
comment: "ประเภทตำแหน่ง",
})
posTypeId: string;
@Column({
length: 40,
comment: "ระดับตำแหน่ง",
})
posLevelId: string;
@Column({
nullable: true,
length: 40,
comment: "ตำแหน่งทางการบริหาร",
2024-02-01 11:02:35 +07:00
default: null,
2024-01-30 16:02:34 +07:00
})
posExecutiveId: string;
@Column({
nullable: true,
comment: "ด้านทางการบริหาร",
length: 255,
2024-02-01 11:02:35 +07:00
default: null,
2024-01-30 16:02:34 +07:00
})
positionExecutiveField: string;
@Column({
nullable: true,
comment: "ด้าน/สาขา",
length: 255,
2024-02-01 11:02:35 +07:00
default: null,
2024-01-30 16:02:34 +07:00
})
positionArea: string;
@Column({
comment: "เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?",
2024-02-01 11:02:35 +07:00
default: false,
2024-01-30 16:02:34 +07:00
})
positionIsSelected: boolean;
@Column({
length: 40,
comment: "เชื่อมโยงกับตารางเลขที่ตำแหน่ง",
})
posMasterId: string;
2024-01-31 14:29:39 +07:00
@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;
2024-01-30 16:02:34 +07:00
}
export class CreatePosition {
@Column()
positionName: string;
@Column()
positionField: string;
@Column()
posTypeId: string;
@Column()
posLevelId: string;
@Column()
posExecutiveId: string;
@Column()
positionExecutiveField: string;
@Column()
positionArea: string;
}
2024-01-31 14:29:39 +07:00
export type UpdatePosition = Partial<CreatePosition>;