hrms-api-development/src/entities/PlannedGoal.ts
2024-04-17 15:27:37 +07:00

100 lines
2.6 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Development } from "./Development";
import { CreatePlannedGoalPosition, PlannedGoalPosition } from "./PlannedGoalPosition";
@Entity("plannedGoal")
export class PlannedGoal extends EntityBase {
@Column({
nullable: true,
comment: "กลุ่มเป้าหมาย",
default: null,
})
groupTarget: string;
@Column({
nullable: true,
comment: "กลุ่มเป้าหมายย่อย",
default: null,
})
groupTargetSub: string;
// @Column({
// nullable: true,
// comment: "ตำแหน่ง",
// default: null,
// })
// position: string;
// @Column({
// nullable: true,
// comment: "ประเภทตำแหน่ง",
// default: null,
// })
// posTypePlannedId: string;
// @ManyToOne(() => PosType, (posType: PosType) => posType.plannedGoals)
// @JoinColumn({ name: "posTypePlannedId" })
// posTypePlanned: PosType;
// @Column({
// nullable: true,
// comment: "ระดับตำแหน่ง",
// default: null,
// })
// posLevelPlannedId: string;
// @ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.plannedGoals)
// @JoinColumn({ name: "posLevelPlannedId" })
// posLevelPlanned: PosLevel;
@Column({
nullable: true,
comment: "ประเภท(กลุ่มอาชีพ คุณสมบัติ)",
default: null,
})
type: string;
@Column({
nullable: true,
comment: "จำนวน(คน)",
default: null,
})
amount: number;
@Column({
nullable: true,
comment: "id โครงการ",
default: null,
})
developmentPlannedGoalId: string;
@ManyToOne(() => Development, (development: Development) => development.developmentPlannedGoals)
@JoinColumn({ name: "developmentPlannedGoalId" })
developmentPlannedGoal: Development;
@OneToMany(
() => PlannedGoalPosition,
(plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.plannedGoal,
)
plannedGoalPositions: PlannedGoalPosition[];
}
export class CreatePlannedGoal {
@Column()
groupTarget: string | null;
@Column()
groupTargetSub: string | null;
@Column()
positions: CreatePlannedGoalPosition[];
// @Column()
// posTypePlannedId: string | null;
// @Column()
// posLevelPlannedId: string | null;
@Column()
type: string | null;
@Column()
amount: number | null;
}
export type UpdatePlannedGoal = Partial<CreatePlannedGoal>;