From c4db19ba0c26aef7dc16f1bffb57f3aaf74f58aa Mon Sep 17 00:00:00 2001 From: Samuli Virtapohja <l4721@student.jamk.fi> Date: Mon, 1 Jul 2019 08:46:35 +0300 Subject: [PATCH] changes --- ormconfig.json | 4 ++-- src/draw/draw.controller.ts | 8 ++++---- src/game/game.controller.ts | 5 +++++ src/game/game.service.ts | 8 ++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ormconfig.json b/ormconfig.json index 2e27168..719a97d 100644 --- a/ormconfig.json +++ b/ormconfig.json @@ -4,9 +4,9 @@ "port": 5444, "username": "postgres", "password": "mysecretpassword", - "database": "test", + "database": "test2", "entities": ["src/**/*.entity{.ts,.js}"], "synchronize": true, "logging": true, - "dropSchema": false + "dropSchema": true } diff --git a/src/draw/draw.controller.ts b/src/draw/draw.controller.ts index 19b9d27..c721fc5 100644 --- a/src/draw/draw.controller.ts +++ b/src/draw/draw.controller.ts @@ -43,8 +43,8 @@ export class DrawController { return this.drawService.drawMap(id, data); } - @Put('location') - @UseGuards(new AuthGuard()) - @UsePipes(new ValidationPipe()) - async trackLocation() {} + // @Put('location') + // @UseGuards(new AuthGuard()) + // @UsePipes(new ValidationPipe()) + // async trackLocation() {} } diff --git a/src/game/game.controller.ts b/src/game/game.controller.ts index bd6551a..cb0d2d6 100644 --- a/src/game/game.controller.ts +++ b/src/game/game.controller.ts @@ -85,6 +85,11 @@ export class GameController { return this.gameservice.listGames(); } + @Get('get-faction-members/:id') + async getFactionMembers(@Param('id') factionId) { + return this.gameservice.listFactionMembers(factionId); + } + @Get(':id') async returnGameInfo(@Param('id') id: string) { return this.gameservice.returnGameInfo(id); diff --git a/src/game/game.service.ts b/src/game/game.service.ts index 5710752..7356cec 100644 --- a/src/game/game.service.ts +++ b/src/game/game.service.ts @@ -199,6 +199,14 @@ export class GameService { }); } + async listFactionMembers(faction) { + return await this.game_PersonRepository.find({ + where: { faction }, + relations: ['person'], + order: { person: 'DESC' }, + }); + } + // returns information about a game identified by id async returnGameInfo(id: string) { const game = await this.gameRepository.findOne({ -- GitLab