Skip to content
Snippets Groups Projects

Development to testing

Merged Ghost User requested to merge Development into testing
4 files
+ 18
5
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -41,9 +41,11 @@ export class GameController {
@@ -41,9 +41,11 @@ export class GameController {
private gameservice: GameService,
private gameservice: GameService,
private tickservice: TickService,
private tickservice: TickService,
) {
) {
 
// starts timer
this.tickservice.startTimer();
this.tickservice.startTimer();
}
}
 
//new game
@Post('new')
@Post('new')
@UseGuards(new AuthGuard())
@UseGuards(new AuthGuard())
@UsePipes(new ValidationPipe())
@UsePipes(new ValidationPipe())
@@ -51,6 +53,7 @@ export class GameController {
@@ -51,6 +53,7 @@ export class GameController {
return this.gameservice.createNewGame(person, body);
return this.gameservice.createNewGame(person, body);
}
}
 
// edit game
@Put('edit/:id')
@Put('edit/:id')
@Roles('admin')
@Roles('admin')
@GameStates('CREATED')
@GameStates('CREATED')
@@ -60,6 +63,7 @@ export class GameController {
@@ -60,6 +63,7 @@ export class GameController {
return this.gameservice.editGame(id, body);
return this.gameservice.editGame(id, body);
}
}
 
// delete game
@Delete('delete/:id')
@Delete('delete/:id')
@Roles('admin')
@Roles('admin')
@GameStates('CREATED')
@GameStates('CREATED')
@@ -67,6 +71,7 @@ export class GameController {
@@ -67,6 +71,7 @@ export class GameController {
return this.gameservice.deleteGame(id);
return this.gameservice.deleteGame(id);
}
}
 
// change game state
@Put('edit-state/:id')
@Put('edit-state/:id')
@Roles('admin')
@Roles('admin')
@UsePipes(new ValidationPipe())
@UsePipes(new ValidationPipe())
@@ -74,11 +79,13 @@ export class GameController {
@@ -74,11 +79,13 @@ export class GameController {
return this.gameservice.updateGameStatus(body);
return this.gameservice.updateGameStatus(body);
}
}
 
// list all games
@Get('listgames')
@Get('listgames')
async listGames(state) {
async listGames(state) {
return this.gameservice.listGames(state);
return this.gameservice.listGames(state);
}
}
 
// list games based on parameter
@Get('listgames/:state')
@Get('listgames/:state')
async listGamesState(@Param('state') state: string) {
async listGamesState(@Param('state') state: string) {
return this.gameservice.listGames(state);
return this.gameservice.listGames(state);
@@ -91,28 +98,33 @@ export class GameController {
@@ -91,28 +98,33 @@ export class GameController {
return this.gameservice.returnGameInfo(id);
return this.gameservice.returnGameInfo(id);
}
}
 
//get all factions
@Get('get-factions/:id')
@Get('get-factions/:id')
@Roles('admin')
@Roles('admin')
async returnGameFactions(@Param('id') id: GameEntity) {
async returnGameFactions(@Param('id') id: GameEntity) {
return this.gameservice.listFactions(id);
return this.gameservice.listFactions(id);
}
}
 
// get flagbox events
@Get('flag-events/:id')
@Get('flag-events/:id')
async returnFlagboxInfo(@Param('id') id: GameEntity) {
async returnFlagboxInfo(@Param('id') id: GameEntity) {
return this.gameservice.returnObjectivePointInfo(id);
return this.gameservice.returnObjectivePointInfo(id);
}
}
 
// initial settings for flagbox
@Get('flag/:id')
@Get('flag/:id')
async flagboxQuery(@Param('id') id: string) {
async flagboxQuery(@Param('id') id: string) {
return this.gameservice.flagboxQuery(id);
return this.gameservice.flagboxQuery(id);
}
}
 
// flagbox event
@Post('flag/:id')
@Post('flag/:id')
@GameStates('STARTED')
@GameStates('STARTED')
async flagboxEvent(@Param('id') id: string, @Body() data: FlagboxEventDTO) {
async flagboxEvent(@Param('id') id: string, @Body() data: FlagboxEventDTO) {
return this.gameservice.flagboxEvent(id, data);
return this.gameservice.flagboxEvent(id, data);
}
}
 
// image upload
@Post('upload')
@Post('upload')
@UseInterceptors(
@UseInterceptors(
FileInterceptor('image', {
FileInterceptor('image', {
@@ -134,6 +146,7 @@ export class GameController {
@@ -134,6 +146,7 @@ export class GameController {
return image;
return image;
}
}
 
// get images
@Get('images/:img')
@Get('images/:img')
returnImage(@Param('img') image, @Res() res) {
returnImage(@Param('img') image, @Res() res) {
return res.sendFile(image, { root: 'images' });
return res.sendFile(image, { root: 'images' });
Loading