mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-01-20 01:34:47 +00:00
Update games service to include find by gametype
This commit is contained in:
parent
38fb66da06
commit
75f6e64a1f
|
|
@ -14,7 +14,7 @@ export class GamesController {
|
||||||
return this.gameService.findAll({ limit, offset });
|
return this.gameService.findAll({ limit, offset });
|
||||||
}
|
}
|
||||||
|
|
||||||
// /gametype/:gameId
|
// /gametype/:gametype
|
||||||
@Get('gametype/:gametype')
|
@Get('gametype/:gametype')
|
||||||
findByType(@Param('gametype') gametype: string) {
|
findByType(@Param('gametype') gametype: string) {
|
||||||
return this.gameService.findByType(gametype);
|
return this.gameService.findByType(gametype);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,14 @@ export class GamesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async findByType(gametype: string) {
|
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) {
|
if (!game) {
|
||||||
throw new NotFoundException(`Game Type: ${gametype} not found`);
|
throw new NotFoundException(`Game Type: ${gametype} not found`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue