Newer
Older
import { Controller, Post, Param, UsePipes, Body, Get } from '@nestjs/common';
import { TrackingService } from './tracking.service';
import { Roles, GameStates } from '../shared/guard.decorator';
import { ValidationPipe } from '../shared/validation.pipe';
@Controller('tracking')
export class TrackingController {
constructor(private trackingservice: TrackingService) {}
// inserts tracking data to the database
// :id is the id of the game
@Post('location/:id')
@Roles('soldier')
return this.trackingservice.trackLocation(gameperson, id, trackdata);
@Get('players/:id')
@Roles('admin', 'factionleader')
@GameStates('STARTED', 'PAUSED')
async getPlayerLocations(@GamePerson() gameperson, @Param('id') gameId) {
return this.trackingservice.getPlayers(gameperson, gameId);