import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { PosType } from "./PosType"; import { PosLevel } from "./PosLevel"; import { PlannedGoal } from "./PlannedGoal"; @Entity("plannedGoalPosition") export class PlannedGoalPosition extends EntityBase { @Column({ nullable: true, comment: "ตำแหน่ง", default: null, }) position: string; @Column({ nullable: true, comment: "ประเภทตำแหน่ง", default: null, }) posTypePlannedId: string; @ManyToOne(() => PosType, (posType: PosType) => posType.plannedGoalPositions) @JoinColumn({ name: "posTypePlannedId" }) posTypePlanned: PosType; @Column({ nullable: true, comment: "ระดับตำแหน่ง", default: null, }) posLevelPlannedId: string; @ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.plannedGoalPositions) @JoinColumn({ name: "posLevelPlannedId" }) posLevelPlanned: PosLevel; @Column({ nullable: true, comment: "id โครงการ", default: null, }) plannedGoalId: string; @ManyToOne(() => PlannedGoal, (plannedGoal: PlannedGoal) => plannedGoal.plannedGoalPositions) @JoinColumn({ name: "plannedGoalId" }) plannedGoal: PlannedGoal; } export class CreatePlannedGoalPosition { @Column() position: string | null; @Column() posTypePlannedId: string | null; @Column() posLevelPlannedId: string | null; } export type UpdatePlannedGoalPosition = Partial;