From a737daeeaa1f64fc63963c3766fbf120704fb1a9 Mon Sep 17 00:00:00 2001
From: L4168 <L4168@student.jamk.fi>
Date: Wed, 10 Jul 2019 12:36:54 +0300
Subject: [PATCH] updated faction verify service

---
 src/faction/faction.service.ts | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/faction/faction.service.ts b/src/faction/faction.service.ts
index 0694033..ab1dd01 100644
--- a/src/faction/faction.service.ts
+++ b/src/faction/faction.service.ts
@@ -134,12 +134,16 @@ export class FactionService {
       where: { person, game },
       relations: ['faction'],
     });
-    if (gameperson) {
+    if (gameperson.faction) {
       return {
         factionId: gameperson.faction.factionId,
+        factionName: gameperson.faction.factionName,
       };
     } else {
-      throw new HttpException('No faction was found', HttpStatus.BAD_REQUEST);
+      throw new HttpException(
+        gameperson ? 'You are admin for this game!' : 'No faction was found',
+        HttpStatus.BAD_REQUEST,
+      );
     }
   }
 }
-- 
GitLab