From a387343eed56a478723aac356b47d920e9a39d17 Mon Sep 17 00:00:00 2001
From: L4168 <L4168@student.jamk.fi>
Date: Thu, 27 Jun 2019 11:45:32 +0300
Subject: [PATCH] updated table to match db design

---
 src/task/task.entity.ts | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/task/task.entity.ts b/src/task/task.entity.ts
index 1e74701..e6fd618 100644
--- a/src/task/task.entity.ts
+++ b/src/task/task.entity.ts
@@ -1,15 +1,25 @@
-import { PrimaryGeneratedColumn, Column, Entity, ManyToOne } from 'typeorm';
+import {
+  PrimaryGeneratedColumn,
+  Column,
+  Entity,
+  ManyToOne,
+  JoinColumn,
+} from 'typeorm';
 import { FactionEntity } from 'src/game/faction.entity';
+import { GameEntity } from 'src/game/game.entity';
 
 @Entity('Task')
 export class TaskEntity {
   @PrimaryGeneratedColumn('uuid') taskId: string;
   @Column({ type: 'text' }) taskName: string;
   @Column({ type: 'text' }) taskDescription: string;
-  @Column({ type: 'float' }) taskScore: number;
-  @Column({ type: 'text' }) taskWinner: string;
   @Column({ type: 'bool' }) taskIsActive: boolean;
 
   @ManyToOne(type => FactionEntity, faction => faction.factionId)
   faction: FactionEntity;
+  @ManyToOne(type => FactionEntity, faction => faction.factionId)
+  taskWinner: FactionEntity;
+  @ManyToOne(type => GameEntity, game => game.id)
+  @JoinColumn({ name: 'taskGame' })
+  taskGame: GameEntity;
 }
-- 
GitLab