2020-08-22 10:19:50 -04:00
|
|
|
import { Controller, Get, Param, Query } from '@nestjs/common';
|
|
|
|
|
import { GamesService } from './games.service';
|
|
|
|
|
|
|
|
|
|
import { PaginationQueryDto } from '../common/dto/pagination-query.dto';
|
|
|
|
|
|
|
|
|
|
@Controller('games')
|
|
|
|
|
export class GamesController {
|
|
|
|
|
constructor(private readonly gameService: GamesService) {}
|
|
|
|
|
|
|
|
|
|
// /games
|
|
|
|
|
@Get()
|
|
|
|
|
findAll(@Query() paginationQuery: PaginationQueryDto) {
|
2020-08-23 10:35:50 -04:00
|
|
|
const { limit = 10, offset = 0 } = paginationQuery;
|
|
|
|
|
return this.gameService.findAll({ limit, offset });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// /gametype/:gameId
|
|
|
|
|
@Get('gametype/:gametype')
|
|
|
|
|
findByType(@Param('gametype') gametype: string) {
|
|
|
|
|
return this.gameService.findByType(gametype);
|
2020-08-22 10:19:50 -04:00
|
|
|
}
|
|
|
|
|
|
2020-08-23 11:04:35 -04:00
|
|
|
// /games/:gameId
|
2020-08-22 10:19:50 -04:00
|
|
|
@Get(':gameId')
|
|
|
|
|
findOne(@Param('gameId') gameId: string) {
|
2020-08-23 10:35:50 -04:00
|
|
|
return this.gameService.findOne(gameId);
|
2020-08-22 10:19:50 -04:00
|
|
|
}
|
|
|
|
|
}
|