From c3a2e613304003b08b703a21e7905f10faa07a9b Mon Sep 17 00:00:00 2001
From: L4168 <L4168@student.jamk.fi>
Date: Wed, 3 Jul 2019 12:48:05 +0300
Subject: [PATCH] added response codes

---
 src/faction/faction.service.ts | 2 ++
 src/game/game.service.ts       | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/src/faction/faction.service.ts b/src/faction/faction.service.ts
index 4402878..76242df 100644
--- a/src/faction/faction.service.ts
+++ b/src/faction/faction.service.ts
@@ -94,6 +94,7 @@ export class FactionService {
     await this.game_PersonRepository.save(gamePerson);
 
     return {
+      code: 201,
       message: 'created new group',
     };
   }
@@ -113,6 +114,7 @@ export class FactionService {
     gamePerson.group = data.groupId;
     await this.game_PersonRepository.save(gamePerson);
     return {
+      code: 200,
       message: 'Joined group',
     };
   }
diff --git a/src/game/game.service.ts b/src/game/game.service.ts
index 37f2e47..573bb22 100644
--- a/src/game/game.service.ts
+++ b/src/game/game.service.ts
@@ -48,6 +48,7 @@ export class GameService {
     });
     await this.game_PersonRepository.insert(gamePerson);
     return {
+      code: 201,
       message: 'New game added',
     };
   }
@@ -106,6 +107,7 @@ export class GameService {
     // TO DO: ADD FLAGBOX LOCATION TO MAPDRAWING ENTITY
 
     return {
+      code: 200,
       message: 'Game updated',
     };
   }
@@ -118,6 +120,7 @@ export class GameService {
     // TODO: Delete factions from Faction table associated with the deleted game
     await this.gameRepository.delete({ id });
     return {
+      code: 200,
       message: 'Game deleted',
     };
   }
@@ -168,5 +171,9 @@ export class GameService {
     await this.objectivePoint_HistoryRepository.insert(eventUpdate);
     // send flagbox event to flagbox subscribers
     this.notificationGateway.server.emit('flagbox', 'event update');
+    return {
+      code: 201,
+      message: 'OK',
+    };
   }
 }
-- 
GitLab