import { Entity, Column, PrimaryGeneratedColumn, OneToMany, ManyToOne, PrimaryColumn } from 'typeorm'; import {Game_PersonEntity, ObjectivePointEntity, GameEntity} from './game.entity' import { FactionEntity } from './faction.entity' @Entity('Coordinate') export class CoordinateEntity { @PrimaryColumn({type: 'json', nullable: true}) features: JSON; @OneToMany(type => MapDrawingEntity, mapDrawings => mapDrawings.mapDrawings_coordinates) mapDrawings: MapDrawingEntity[]; @OneToMany(type => Game_PersonEntity, game_persons => game_persons.game_person_coordinates) game_persons: Game_PersonEntity[]; @OneToMany(type => ObjectivePointEntity, objective_points => objective_points.coordinate) objective_points: ObjectivePointEntity[]; @OneToMany(type => MapEntity, maps => maps.coordinate) maps: ObjectivePointEntity[]; } @Entity('Map') export class MapEntity { @PrimaryGeneratedColumn('uuid') mapId: string; @ManyToOne(type => CoordinateEntity, coordinate => coordinate.maps) coordinate: CoordinateEntity; @OneToMany(type => GameEntity, games => games.map) games: GameEntity[]; @OneToMany(type => MapDrawingEntity, mapDrawings => mapDrawings.map) mapDrawings: MapDrawingEntity[]; } @Entity('MapDrawing') export class MapDrawingEntity { @PrimaryGeneratedColumn('uuid') mapDrawingId: string; @Column({type: 'bool'}) drawingIsActive: boolean; @Column({type: 'time'}) drawingValidTill: string; @ManyToOne(type => CoordinateEntity, mapDrawings_coordinates => mapDrawings_coordinates.mapDrawings) mapDrawings_coordinates: CoordinateEntity; @ManyToOne(type => MapEntity, map => map.mapDrawings) map: MapEntity; @ManyToOne(type => MapDrawingTypeEntity, mapDrawingType => mapDrawingType.mapDrawings) mapDrawingType: MapEntity; @ManyToOne(type => FactionEntity, faction => faction.mapDrawings) faction: FactionEntity; } @Entity('MapDrawingType') export class MapDrawingTypeEntity { @PrimaryGeneratedColumn('uuid') mapDrawingTypeId: string; @Column({type: 'text'}) drawingTypeName: string; @Column({type: 'text'}) drawingTypeDescription: string; @OneToMany(type => MapDrawingEntity, mapDrawings => mapDrawings.mapDrawingType) mapDrawings: MapDrawingEntity[]; }