เพิ่มตำแหน่งเลือกได้หลายอัน

This commit is contained in:
Kittapath 2024-04-09 21:59:23 +07:00
parent 68c31be431
commit 166c919bbe
10 changed files with 424 additions and 115 deletions

View file

@ -1,8 +1,7 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Development } from "./Development";
import { PosType } from "./PosType";
import { PosLevel } from "./PosLevel";
import { CreatePlannedGoalPosition, PlannedGoalPosition } from "./PlannedGoalPosition";
@Entity("plannedGoal")
export class PlannedGoal extends EntityBase {
@ -20,41 +19,41 @@ export class PlannedGoal extends EntityBase {
})
groupTargetSub: string;
@Column({
nullable: true,
comment: "ตำแหน่ง",
default: null,
})
position: string;
// @Column({
// nullable: true,
// comment: "ตำแหน่ง",
// default: null,
// })
// position: string;
@Column({
nullable: true,
comment: "ประเภทตำแหน่ง",
default: null,
})
posTypePlannedId: string;
// @Column({
// nullable: true,
// comment: "ประเภทตำแหน่ง",
// default: null,
// })
// posTypePlannedId: string;
@ManyToOne(() => PosType, (posType: PosType) => posType.plannedGoals)
@JoinColumn({ name: "posTypePlannedId" })
posTypePlanned: PosType;
// @ManyToOne(() => PosType, (posType: PosType) => posType.plannedGoals)
// @JoinColumn({ name: "posTypePlannedId" })
// posTypePlanned: PosType;
@Column({
nullable: true,
comment: "ระดับตำแหน่ง",
default: null,
})
posLevelPlannedId: string;
// @Column({
// nullable: true,
// comment: "ระดับตำแหน่ง",
// default: null,
// })
// posLevelPlannedId: string;
@ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.plannedGoals)
@JoinColumn({ name: "posLevelPlannedId" })
posLevelPlanned: PosLevel;
// @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,
// })
// type: string;
@Column({
nullable: true,
@ -73,6 +72,12 @@ export class PlannedGoal extends EntityBase {
@ManyToOne(() => Development, (development: Development) => development.developmentPlannedGoals)
@JoinColumn({ name: "developmentPlannedGoalId" })
developmentPlannedGoal: Development;
@OneToMany(
() => PlannedGoalPosition,
(plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.plannedGoal,
)
plannedGoalPositions: PlannedGoalPosition[];
}
export class CreatePlannedGoal {
@ -81,11 +86,11 @@ export class CreatePlannedGoal {
@Column()
groupTargetSub: string | null;
@Column()
position: string | null;
@Column()
posTypePlannedId: string | null;
@Column()
posLevelPlannedId: string | null;
positions: CreatePlannedGoalPosition[];
// @Column()
// posTypePlannedId: string | null;
// @Column()
// posLevelPlannedId: string | null;
@Column()
type: string | null;
@Column()