import { Controller, Post, UseGuards, Body, Get, Param } from '@nestjs/common'; import { GameService } from './game.service'; import { AuthGuard } from '../shared/auth.guard'; import { User } from 'src/user/user.decorator'; import { GameDTO, FactionDTO } from './game.dto'; @Controller('game') export class GameController { constructor(private gameservice: GameService) { } @Post('new') @UseGuards(new AuthGuard()) async newGame(@User('id') person, @Body() body) { return this.gameservice.createNewGame(person, body, body.factions); } @Get('listgames') async listGames() { return this.gameservice.listGames(); } @Get(':id') async returnGameInfo(@Param('id') id: string) { return this.gameservice.returnGameInfo(id); } }