Newer
Older
import {
Controller,
Put,
Get,
Param,
UsePipes,
Body,
import { Roles, GameStates } from '../shared/guard.decorator';
import { GamePerson } from '../game/gameperson.decorator';
//////////////////////////////////////////////////////////////////////////
/// DrawController ///
/// ///
/// Functions either insert or return MapDrawing data, ///
/// Insert functions require user to have proper role (either gm ///
/// or commander) in the game to be able store the data: ///
/// MapDrawingDTO data to database. ///
/// Data return functions require atleast spectator role. ///
//////////////////////////////////////////////////////////////////////////
@Controller('draw')
export class DrawController {
constructor(private drawService: DrawService) {}
async draw(
@GamePerson() gameperson,
@Param('id') gameId,
@Body() data: MapDrawingDTO,
) {
return this.drawService.draw(gameperson, gameId, data);
@Roles('admin', 'factionleader', 'soldier', 'groupleader')
@UseInterceptors(ClassSerializerInterceptor)
async drawMap(@GamePerson() gameperson, @Param('id') gameId) {
return this.drawService.drawMap(gameperson, gameId);