Newer
Older
import {
Controller,
Post,
UseGuards,
Body,
Get,
Param,
UsePipes,
Put,
import { GameService } from './game.service';
import { GameDTO, FlagboxEventDTO } from './game.dto';
import { ValidationPipe } from '../shared/validation.pipe';
@Controller('game')
export class GameController {
async newGame(@User('id') person, @Body() body: GameDTO) {
return this.gameservice.createNewGame(person, body);
}
@Roles('admin')
@UsePipes(new ValidationPipe())
async editGame(@Param('id') id: string, @Body() body: GameDTO) {
return this.gameservice.editGame(id, body);
}
@Get('listgames')
async listGames() {
return this.gameservice.listGames();
}
// ClassSerializerInterceptor removes excluded columns set in Entities
@UseInterceptors(ClassSerializerInterceptor)
@Get(':id')
async returnGameInfo(@Param('id') id: string) {
return this.gameservice.returnGameInfo(id);
}
@Get('flag/:id')
async flagboxQuery(@Param('id') id: string) {
async flagboxEvent(@Param('id') id: string, @Body() data: FlagboxEventDTO) {
return this.gameservice.flagboxEvent(id, data);