diff --git a/src/game/game.entity.ts b/src/game/game.entity.ts index 22e171b67e655917d108a66695dae59f32304e4e..cdea35754f50744bf435c349c6ce9a23c2e53337 100644 --- a/src/game/game.entity.ts +++ b/src/game/game.entity.ts @@ -83,16 +83,21 @@ export class ObjectivePointEntity { @PrimaryGeneratedColumn('uuid') objectivePointId: string; @Column({ type: 'text' }) objectivePointDescription: string; @Column({ type: 'float' }) objectivePointMultiplier: number; + @Column({ type: 'json' }) data: JSON; - // If the MapDrawing or Game where the ObjectivePoint was in is deleted, the ObjectivePoint is also deleted - @ManyToOne(type => MapDrawingEntity, coordinate => coordinate.data, { - onDelete: 'CASCADE', - }) - coordinate: MapDrawingEntity; + // If the Game where the ObjectivePoint was in is deleted, the ObjectivePoint is also deleted @ManyToOne(type => GameEntity, game => game.objective_points, { onDelete: 'CASCADE', }) game: GameEntity; + @OneToMany( + () => ObjectivePoint_HistoryEntity, + history => history.objective_point, + { + onDelete: 'NO ACTION', + }, + ) + history: ObjectivePoint_HistoryEntity[]; } @Entity('ObjectivePoint_History') @@ -101,7 +106,7 @@ export class ObjectivePoint_HistoryEntity { @Column({ type: 'timestamp' }) oP_HistoryTimestamp: Timestamp; @Column('float') action: number; - // If the owner Faction, capturer Faction or ObjectivePoint, that has, is trying to have or is the point where + // If the owner Faction, capturer Faction or ObjectivePoint, that has, is trying to have or is the point where // ObjectivePointHistory points to is deleted, the ObjectivePointHistory is also deleted @ManyToOne(type => FactionEntity, factionEntity => factionEntity.factionId, { onDelete: 'CASCADE',