From 521e4c78851fb69a5dbd81a4d2abcad2c50fd4c4 Mon Sep 17 00:00:00 2001
From: L4168 <L4168@student.jamk.fi>
Date: Wed, 10 Jul 2019 09:52:10 +0300
Subject: [PATCH] created gameperson decorator

---
 src/game/gameperson.decorator.ts | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 src/game/gameperson.decorator.ts

diff --git a/src/game/gameperson.decorator.ts b/src/game/gameperson.decorator.ts
new file mode 100644
index 0000000..26c119a
--- /dev/null
+++ b/src/game/gameperson.decorator.ts
@@ -0,0 +1,13 @@
+import { createParamDecorator } from '@nestjs/common';
+
+/* 
+    gives service access to the gameperson object
+    Game_PersonEntity {
+        gamepersonId
+        role
+        faction
+    }
+*/
+export const GamePerson = createParamDecorator((data, req) => {
+  return data ? req.gameperson[data] : req.gameperson;
+});
-- 
GitLab