Code owners
Assign users and groups as approvers for specific file changes. Learn more.
game.entity.ts 2.79 KiB
import { Entity, Column, PrimaryGeneratedColumn, OneToMany, ManyToOne, ManyToMany, Timestamp, JoinTable } from 'typeorm';
import {PersonEntity, PersonRoleEntity} from '../user/user.entity'
import {FactionEntity} from './faction.entity'
import {CoordinateEntity} from './coordinate.entity'
import { MapEntity } from './coordinate.entity'
@Entity('Game')
export class GameEntity {
@PrimaryGeneratedColumn('uuid') gameId: string;
@Column({type: 'text', unique: true}) gameName: string;
@Column({type: 'text'}) gameDescription: string;
@Column({type: 'date'}) startDate: string;
@Column({type: 'date'}) endDate: string;
@Column({type: 'text'}) GM_Password: string;
@ManyToOne(type => MapEntity, map => map.games)
map: MapEntity;
@OneToMany(type => FactionEntity, faction => faction.game)
factions: FactionEntity[];
@OneToMany(type => Game_PersonEntity, game_persons => game_persons.game)
game_persons: Game_PersonEntity[];
@OneToMany(type => ObjectivePointEntity, objective_points => objective_points.game)
objective_points: ObjectivePointEntity[];
gameObject() {
const {gameId, gameName, gameDescription, startDate, endDate, GM_Password} = this;
return this;
}
}
@Entity('Game_Person')
export class Game_PersonEntity {
@PrimaryGeneratedColumn('uuid') gameId: string;
@ManyToOne(type => FactionEntity, faction => faction.game_persons)
faction: FactionEntity;
@ManyToOne(type => GameEntity, game => game.game_persons)
game: GameEntity;
@ManyToOne(type => PersonEntity, person => person.game_persons)
person: PersonEntity;
@ManyToOne(type => PersonRoleEntity, person_role => person_role.game_persons)
person_role: PersonRoleEntity;
@ManyToMany(type => CoordinateEntity, game_person_coordinates => game_person_coordinates.game_persons)
@JoinTable()
game_person_coordinates: CoordinateEntity[];
}
@Entity('ObjectivePoint')
export class ObjectivePointEntity {
@PrimaryGeneratedColumn('uuid') objectivePointId: string;
@Column({type: 'text'}) objectivePointDescription: string;
@ManyToOne(type => CoordinateEntity, coordinate => coordinate.objective_points)
coordinate: CoordinateEntity;
@ManyToOne(type => GameEntity, game => game.objective_points)
game: GameEntity;
@OneToMany(type => ObjectivePoint_HistoryEntity, op_history => op_history.objective_point)
op_history: Game_PersonEntity[];
}
@Entity('ObjectivePoint_History')
export class ObjectivePoint_HistoryEntity {
@PrimaryGeneratedColumn('uuid') oP_HistoryId: string;
@Column({type: 'timestamp'}) oP_HistoryTimestamp: Timestamp;
@Column({/*type: 'timestamp'*/}) oP_HistoryStatus: number;
@ManyToOne(type => ObjectivePointEntity, objective_point => objective_point.op_history)
objective_point: ObjectivePointEntity;
}