From 75f6e64a1f507d518b064aee6e2960b67f2b9552 Mon Sep 17 00:00:00 2001 From: Anthony Mineo Date: Sat, 29 Aug 2020 18:36:24 -0400 Subject: [PATCH] Update games service to include find by gametype --- app/api/src/games/games.controller.ts | 2 +- app/api/src/games/games.service.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/api/src/games/games.controller.ts b/app/api/src/games/games.controller.ts index 686ebc8..66614b1 100644 --- a/app/api/src/games/games.controller.ts +++ b/app/api/src/games/games.controller.ts @@ -14,7 +14,7 @@ export class GamesController { return this.gameService.findAll({ limit, offset }); } - // /gametype/:gameId + // /gametype/:gametype @Get('gametype/:gametype') findByType(@Param('gametype') gametype: string) { return this.gameService.findByType(gametype); diff --git a/app/api/src/games/games.service.ts b/app/api/src/games/games.service.ts index 0fc6cc6..cc16933 100644 --- a/app/api/src/games/games.service.ts +++ b/app/api/src/games/games.service.ts @@ -28,7 +28,14 @@ export class GamesService { } async findByType(gametype: string) { - const game = await this.gamesRepository.find({ where: { gametype: gametype } }); + const game = await this.gamesRepository.find({ + where: { gametype: gametype }, + skip: 0, + take: 10, + order: { + gameId: 'DESC' + } + }); if (!game) { throw new NotFoundException(`Game Type: ${gametype} not found`); }