Newer
Older
import {
Entity,
Column,
PrimaryGeneratedColumn,
ManyToOne,
OneToMany,
Timestamp,
import { MapDrawingEntity } from '../draw/coordinate.entity';
import { PersonEntity } from '../user/user.entity';
import { GameGroupEntity } from '../faction/faction.entity';
import { FactionEntity } from '../faction/faction.entity';
// table that stores all created games
@Entity('Game')
export class GameEntity {
@PrimaryGeneratedColumn('uuid') id: string;
@Column('text') name: string;
@Column('text') desc: string;
@Column({ type: 'json', nullable: true }) nodesettings?: JSON;
@Column('timestamp') startdate: Timestamp;
@Column('timestamp') enddate: Timestamp;
@OneToMany(type => Game_PersonEntity, game_persons => game_persons.game)
game_persons: Game_PersonEntity[];
@OneToMany(
type => ObjectivePointEntity,
objective_points => objective_points.game,
)
objective_points: ObjectivePointEntity[];
@OneToMany(type => TaskEntity, tasks => tasks.taskGame)
tasks: TaskEntity[];
gameObject() {
const { id, name } = this;
return { id, name };
}
// table that stores players associated with particular game
@Entity('Game_Person', {
orderBy: {
person: 'ASC',
},
})
@PrimaryGeneratedColumn('uuid') gamepersonId: string;
@Column({ type: 'text', nullable: true }) role: string;
@ManyToOne(type => GameEntity, game => game.id)
@ManyToOne(type => PersonEntity, person => person.id)
@ManyToOne(type => GameGroupEntity, group => group.players, {
@Entity('ObjectivePoint')
export class ObjectivePointEntity {
@PrimaryGeneratedColumn('uuid') objectivePointId: string;
@Column({ type: 'text' }) objectivePointDescription: string;
@Column({ type: 'float' }) objectivePointMultiplier: number;
@ManyToOne(type => MapDrawingEntity, coordinate => coordinate.data)
coordinate: MapDrawingEntity;
@ManyToOne(type => GameEntity, game => game.objective_points)
game: GameEntity;
}
@Entity('ObjectivePoint_History')
export class ObjectivePoint_HistoryEntity {
@PrimaryGeneratedColumn('uuid') oP_HistoryId: string;
@Column({ type: 'timestamp' }) oP_HistoryTimestamp: Timestamp;
@Column('float') action: number;
@ManyToOne(type => FactionEntity, factionEntity => factionEntity.factionId)
capture: FactionEntity;
@ManyToOne(type => FactionEntity, factionentity => factionentity.factionId)
owner: FactionEntity;
objective_point => objective_point.objectivePointId,