From 42f19b791258a670b72c1590dc248ba4bd15040e Mon Sep 17 00:00:00 2001
From: Samuli Virtapohja <l4721@student.jamk.fi>
Date: Mon, 24 Jun 2019 14:04:30 +0300
Subject: [PATCH] lippubox merget

---
 package-lock.json        | 28 +++++++++++++++++++++-------
 src/game/game.service.ts |  6 +++---
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index e2dcee8..d6db2b3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3147,12 +3147,14 @@
         "balanced-match": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "brace-expansion": {
           "version": "1.1.11",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "balanced-match": "^1.0.0",
             "concat-map": "0.0.1"
@@ -3167,17 +3169,20 @@
         "code-point-at": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "concat-map": {
           "version": "0.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "console-control-strings": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "core-util-is": {
           "version": "1.0.2",
@@ -3294,7 +3299,8 @@
         "inherits": {
           "version": "2.0.3",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "ini": {
           "version": "1.3.5",
@@ -3306,6 +3312,7 @@
           "version": "1.0.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "number-is-nan": "^1.0.0"
           }
@@ -3320,6 +3327,7 @@
           "version": "3.0.4",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "brace-expansion": "^1.1.7"
           }
@@ -3327,12 +3335,14 @@
         "minimist": {
           "version": "0.0.8",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "minipass": {
           "version": "2.3.5",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "safe-buffer": "^5.1.2",
             "yallist": "^3.0.0"
@@ -3351,6 +3361,7 @@
           "version": "0.5.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "minimist": "0.0.8"
           }
@@ -3431,7 +3442,8 @@
         "number-is-nan": {
           "version": "1.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "object-assign": {
           "version": "4.1.1",
@@ -3443,6 +3455,7 @@
           "version": "1.4.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "wrappy": "1"
           }
@@ -3565,6 +3578,7 @@
           "version": "1.0.2",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "code-point-at": "^1.0.0",
             "is-fullwidth-code-point": "^1.0.0",
diff --git a/src/game/game.service.ts b/src/game/game.service.ts
index f8d3c72..ea11a66 100644
--- a/src/game/game.service.ts
+++ b/src/game/game.service.ts
@@ -47,7 +47,7 @@ export class GameService {
       // else add the game to the database
       const game = await this.gameRepository.create({
         ...gameData,
-        factionsId: gameData.factions,
+        factions: gameData.factions,
       });
       await this.gameRepository.insert(game);
       const gamePerson = await this.game_PersonRepository.create({
@@ -76,7 +76,7 @@ export class GameService {
       // update game entry in db
       const updatedGame = await this.gameRepository.create({
         ...gameData,
-        factionsId: null,
+        factions: null,
         objective_points: null,
       });
       updatedGame['id'] = id;
@@ -243,7 +243,7 @@ export class GameService {
   // add events to history and send updates with socket
   async flagboxEvent(gameId, data: FlagboxEventDTO) {
     // get all the factions associated with the game
-    const factionRef = await this.factionRepository.find({ game: gameId });
+    const factionRef = await this.factionRepository.find({ gameId: gameId });
     // get reference to the objective
     const objectiveRef = await this.objectivePointRepository.findOne({
       where: { objectivePointDescription: data.node_id, game: gameId },
-- 
GitLab