diff --git a/src/game/game.controller.ts b/src/game/game.controller.ts index a97155c82d672de5092b9cf246f7e2c21f49f48b..015baf9673563cd8732ce15493e80e23c19e0e6b 100644 --- a/src/game/game.controller.ts +++ b/src/game/game.controller.ts @@ -17,6 +17,7 @@ import { User } from '../user/user.decorator'; import { GameDTO, FlagboxEventDTO } from './game.dto'; import { ValidationPipe } from '../shared/validation.pipe'; import { Roles } from '../shared/roles.decorator'; +import { GameEntity } from './game.entity'; @Controller('game') export class GameController { @@ -48,6 +49,12 @@ export class GameController { return this.gameservice.returnGameInfo(id); } + @Get('get-factions/:id') + @Roles('admin') + async returnGameFactions(@Param('id') id: GameEntity) { + return this.gameservice.listFactions(id); + } + @Get('flag/:id') async flagboxQuery(@Param('id') id: string) { return this.gameservice.flagboxQuery(id); diff --git a/src/game/game.service.ts b/src/game/game.service.ts index 9a74a46d8506ccc4a1d03dc6873ba86d74758bb6..37f2e47c2888e107c20cb7413a499cc737ca189c 100644 --- a/src/game/game.service.ts +++ b/src/game/game.service.ts @@ -110,6 +110,10 @@ export class GameService { }; } + async listFactions(game: GameEntity) { + return this.factionRepository.find({ game }); + } + async deleteGame(id) { // TODO: Delete factions from Faction table associated with the deleted game await this.gameRepository.delete({ id });