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

cleaning up

parent e92c2d8b
No related branches found
No related tags found
3 merge requests!59Development to master,!31Development,!23Faction tasks + Piirto
...@@ -21,14 +21,14 @@ export class FactionEntity { ...@@ -21,14 +21,14 @@ export class FactionEntity {
@OneToMany(type => Game_PersonEntity, game_persons => game_persons.faction) @OneToMany(type => Game_PersonEntity, game_persons => game_persons.faction)
game_persons: Game_PersonEntity[]; game_persons: Game_PersonEntity[];
@ManyToOne(type => GameEntity, game => game.id) @ManyToOne(type => GameEntity, game => game.factions)
gameId: GameEntity; game: GameEntity;
@OneToMany(type => MapDrawingEntity, mapDrawings => mapDrawings.faction) @OneToMany(type => MapDrawingEntity, mapDrawings => mapDrawings.faction)
mapDrawings: MapDrawingEntity[]; mapDrawings: MapDrawingEntity[];
factionObject() { factionObject() {
const { factionId, factionName, gameId } = this; const { factionId, factionName, game } = this;
return { factionId, factionName, gameId }; return { factionId, factionName, game };
} }
} }
......
...@@ -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.gameId) @OneToMany(type => FactionEntity, factions => factions.game)
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[];
...@@ -52,7 +52,7 @@ export class GameEntity { ...@@ -52,7 +52,7 @@ export class GameEntity {
export class Game_PersonEntity { export class Game_PersonEntity {
@PrimaryGeneratedColumn('uuid') gamepersonId: string; @PrimaryGeneratedColumn('uuid') gamepersonId: string;
@Column({ type: 'text', nullable: true }) role: string; @Column({ type: 'text', nullable: true }) role: string;
@ManyToOne(type => FactionEntity, faction => faction) @ManyToOne(type => FactionEntity, faction => faction.game_persons)
faction: FactionEntity; faction: FactionEntity;
@ManyToOne(type => GameEntity, game => game.id) @ManyToOne(type => GameEntity, game => game.id)
game: GameEntity; game: GameEntity;
......
...@@ -86,7 +86,7 @@ export class GameService { ...@@ -86,7 +86,7 @@ export class GameService {
if (!Object.values(factionNames).includes(faction.factionName)) { if (!Object.values(factionNames).includes(faction.factionName)) {
let name = await this.factionRepository.create({ let name = await this.factionRepository.create({
...faction, ...faction,
gameId: gameId, game: gameId,
}); });
await this.factionRepository.insert(name); await this.factionRepository.insert(name);
} }
...@@ -217,7 +217,7 @@ export class GameService { ...@@ -217,7 +217,7 @@ export class GameService {
// add events to history and send updates with socket // add events to history and send updates with socket
async flagboxEvent(gameId, data: FlagboxEventDTO) { async flagboxEvent(gameId, data: FlagboxEventDTO) {
// get all the factions associated with the game // get all the factions associated with the game
const factionRef = await this.factionRepository.find({ gameId: gameId }); const factionRef = await this.factionRepository.find({ game: gameId });
// get reference to the objective // get reference to the objective
const objectiveRef = await this.objectivePointRepository.findOne({ const objectiveRef = await this.objectivePointRepository.findOne({
where: { objectivePointDescription: data.node_id, game: gameId }, where: { objectivePointDescription: data.node_id, game: gameId },
......
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