migrate (ตัด relation ฟิลด์ posType, posLevel, empPosType, empPosLevel)

This commit is contained in:
Bright 2025-04-11 10:58:34 +07:00
parent 60781ea254
commit dbfc678e92
6 changed files with 255 additions and 178 deletions

View file

@ -29,25 +29,39 @@ export class ActualGoal extends EntityBase {
@Column({
nullable: true,
comment: "ประเภทตำแหน่ง",
comment: "ประเภทตำแหน่ง & กลุ่มงาน",
default: null,
})
posTypeActualId: string;
posTypeActual: string;
// @Column({
// nullable: true,
// comment: "ประเภทตำแหน่ง",
// default: null,
// })
// posTypeActualId: string;
@ManyToOne(() => PosType, (posType: PosType) => posType.actualGoals)
@JoinColumn({ name: "posTypeActualId" })
posTypeActual: PosType;
// @ManyToOne(() => PosType, (posType: PosType) => posType.actualGoals)
// @JoinColumn({ name: "posTypeActualId" })
// posTypeActual: PosType;
@Column({
nullable: true,
comment: "ระดับตำแหน่ง",
comment: "ระดับตำแหน่ง & ระดับชั้นงาน",
default: null,
})
posLevelActualId: string;
posLevelActual: string;
@ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.actualGoals)
@JoinColumn({ name: "posLevelActualId" })
posLevelActual: PosLevel;
// @Column({
// nullable: true,
// comment: "ระดับตำแหน่ง",
// default: null,
// })
// posLevelActualId: string;
// @ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.actualGoals)
// @JoinColumn({ name: "posLevelActualId" })
// posLevelActual: PosLevel;
@Column({
nullable: true,
@ -82,10 +96,14 @@ export class CreateActualGoal {
groupTargetSub: string | null;
@Column()
position: string | null;
// @Column()
// posTypeActualId: string | null;
// @Column()
// posLevelActualId: string | null;
@Column()
posTypeActualId: string | null;
posTypeActual: string | null;
@Column()
posLevelActualId: string | null;
posLevelActual: string | null;
@Column()
type: string | null;
@Column()

View file

@ -22,25 +22,39 @@ export class PlannedGoalPosition extends EntityBase {
@Column({
nullable: true,
comment: "ประเภทตำแหน่ง",
comment: "ประเภทตำแหน่ง & กลุ่มงาน",
default: null,
})
posTypePlannedId: string;
posTypePlanned: string;
@ManyToOne(() => PosType, (posType: PosType) => posType.plannedGoalPositions)
@JoinColumn({ name: "posTypePlannedId" })
posTypePlanned: PosType;
// @Column({
// nullable: true,
// comment: "ประเภทตำแหน่ง",
// default: null,
// })
// posTypePlannedId: string;
// @ManyToOne(() => PosType, (posType: PosType) => posType.plannedGoalPositions)
// @JoinColumn({ name: "posTypePlannedId" })
// posTypePlanned: PosType;
@Column({
nullable: true,
comment: "ระดับตำแหน่ง",
comment: "ระดับตำแหน่ง & ระดับชั้นงาน",
default: null,
})
posLevelPlannedId: string;
posLevelPlanned: string;
@ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.plannedGoalPositions)
@JoinColumn({ name: "posLevelPlannedId" })
posLevelPlanned: PosLevel;
// @Column({
// nullable: true,
// comment: "ระดับตำแหน่ง",
// default: null,
// })
// posLevelPlannedId: string;
// @ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.plannedGoalPositions)
// @JoinColumn({ name: "posLevelPlannedId" })
// posLevelPlanned: PosLevel;
@Column({
nullable: true,
@ -59,10 +73,14 @@ export class CreatePlannedGoalPosition {
position: string | null;
@Column()
posExecutive: string | null;
// @Column()
// posTypePlannedId: string | null;
// @Column()
// posLevelPlannedId: string | null;
@Column()
posTypePlannedId: string | null;
posTypePlanned: string | null;
@Column()
posLevelPlannedId: string | null;
posLevelPlanned: string | null;
}
export type UpdatePlannedGoalPosition = Partial<CreatePlannedGoalPosition>;

View file

@ -48,14 +48,14 @@ export class PosLevel extends EntityBase {
@JoinColumn({ name: "posTypeId" })
posType: PosType;
@OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.posLevelActual)
actualGoals: ActualGoal[];
// @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.posLevelActual)
// actualGoals: ActualGoal[];
@OneToMany(
() => PlannedGoalPosition,
(plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.posLevelPlanned,
)
plannedGoalPositions: PlannedGoalPosition[];
// @OneToMany(
// () => PlannedGoalPosition,
// (plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.posLevelPlanned,
// )
// plannedGoalPositions: PlannedGoalPosition[];
@OneToMany(() => DevelopmentHistory, (developmentHistory) => developmentHistory.posLevel)
developmentHistorys: DevelopmentHistory[];

View file

@ -28,14 +28,14 @@ export class PosType extends EntityBase {
@OneToMany(() => PosLevel, (posLevel: PosLevel) => posLevel.posType)
posLevels: PosLevel[];
@OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.posTypeActual)
actualGoals: ActualGoal[];
// @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.posTypeActual)
// actualGoals: ActualGoal[];
@OneToMany(
() => PlannedGoalPosition,
(plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.posTypePlanned,
)
plannedGoalPositions: PlannedGoalPosition[];
// @OneToMany(
// () => PlannedGoalPosition,
// (plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.posTypePlanned,
// )
// plannedGoalPositions: PlannedGoalPosition[];
@OneToMany(() => DevelopmentHistory, (developmentHistory) => developmentHistory.posType)
developmentHistorys: DevelopmentHistory[];