Code owners
Assign users and groups as approvers for specific file changes. Learn more.
game.controller.ts 801 B
import { Controller, Post, UseGuards, Body, Get } from '@nestjs/common';
import { GameService } from './game.service';
import { AuthGuard } from 'dist/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) {
//@Body() game: GameDTO, @Body() factions: FactionDTO[]
//return body;
return this.gameservice.createNewGame(person, body, body.factions);
//game: GameDTO, @Body() factions: FactionDTO[]
}
@Get('listgames')
async listGames() {
return this.gameservice.listGames();
}
}