Skip to content
Snippets Groups Projects
Commit e92c2d8b authored by L4168's avatar L4168
Browse files

fixing game list bug

parent f54d6580
No related branches found
No related tags found
3 merge requests!59Development to master,!31Development,!23Faction tasks + Piirto
...@@ -2,21 +2,27 @@ import { ...@@ -2,21 +2,27 @@ import {
Entity, Entity,
Column, Column,
PrimaryGeneratedColumn, PrimaryGeneratedColumn,
OneToMany,
ManyToOne, ManyToOne,
PrimaryColumn,
Timestamp, Timestamp,
} from 'typeorm'; } from 'typeorm';
import { GameEntity, Game_PersonEntity } from './game.entity'; import {
Game_PersonEntity,
ObjectivePointEntity,
GameEntity,
} from './game.entity';
import { FactionEntity } from './faction.entity'; import { FactionEntity } from './faction.entity';
@Entity('MapDrawing') @Entity('MapDrawing')
export class MapDrawingEntity { export class MapDrawingEntity {
@PrimaryGeneratedColumn('uuid') mapDrawingId: string; @PrimaryGeneratedColumn('uuid') mapDrawingId: string;
@Column({ type: 'bool' }) drawingIsActive: boolean; @Column({ type: 'bool', nullable: true }) drawingIsActive: boolean;
@Column({ type: 'time' }) drawingValidTill: string; @Column({ type: 'time', nullable: true }) drawingValidTill: string;
@Column({ type: 'json', nullable: true }) data: JSON; @Column({ type: 'json', nullable: true }) data: JSON;
@ManyToOne(type => FactionEntity, faction => faction.factionId) @ManyToOne(type => FactionEntity, faction => faction.mapDrawings)
faction: FactionEntity; faction: FactionEntity;
@ManyToOne(type => GameEntity, gameEntity => gameEntity.id) @ManyToOne(type => GameEntity, gameEntity => gameEntity.id)
gameId: GameEntity; gameId: GameEntity;
......
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
} from 'typeorm'; } from 'typeorm';
import { GameEntity } from './game.entity'; import { GameEntity } from './game.entity';
import { Game_PersonEntity } from './game.entity'; import { Game_PersonEntity } from './game.entity';
import { MapDrawingEntity } from './coordinate.entity';
//Faction, PowerUp, Faction_powerUp, FP_History, Score //Faction, PowerUp, Faction_powerUp, FP_History, Score
...@@ -22,6 +23,13 @@ export class FactionEntity { ...@@ -22,6 +23,13 @@ export class FactionEntity {
game_persons: Game_PersonEntity[]; game_persons: Game_PersonEntity[];
@ManyToOne(type => GameEntity, game => game.id) @ManyToOne(type => GameEntity, game => game.id)
gameId: GameEntity; gameId: GameEntity;
@OneToMany(type => MapDrawingEntity, mapDrawings => mapDrawings.faction)
mapDrawings: MapDrawingEntity[];
factionObject() {
const { factionId, factionName, gameId } = this;
return { factionId, factionName, gameId };
}
} }
@Entity('PowerUp') @Entity('PowerUp')
......
...@@ -29,7 +29,7 @@ export class GameEntity { ...@@ -29,7 +29,7 @@ export class GameEntity {
@Column('timestamp') startdate: Timestamp; @Column('timestamp') startdate: Timestamp;
@Column('timestamp') enddate: Timestamp; @Column('timestamp') enddate: Timestamp;
@OneToMany(type => FactionEntity, factions => factions.factionId) @OneToMany(type => FactionEntity, factions => factions.gameId)
factions: FactionEntity[]; factions: FactionEntity[];
@OneToMany(type => Game_PersonEntity, game_persons => game_persons.game) @OneToMany(type => Game_PersonEntity, game_persons => game_persons.game)
game_persons: Game_PersonEntity[]; game_persons: Game_PersonEntity[];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment