Ajout d'un endpoint pour essayer de réparer un état éventuellement cassé
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
import { Controller, Delete, Get, HttpCode, Post, UseGuards } from '@nestjs/common'
|
||||
import { Controller, Delete, Get, Post, Put, UseGuards } from '@nestjs/common'
|
||||
import { GameService } from './game.service'
|
||||
import { JwtAuthGuard } from 'src/auth/jwt-auth.guard'
|
||||
import { ApiBearerAuth, ApiNoContentResponse, ApiOkResponse, ApiOperation, ApiUnauthorizedResponse } from '@nestjs/swagger'
|
||||
import { ApiBearerAuth } from '@nestjs/swagger'
|
||||
import { GameEntity } from './entities/game.entity'
|
||||
import { RepairGame } from './dto/repair-game.dto'
|
||||
|
||||
@Controller('game')
|
||||
export class GameController {
|
||||
@ -60,4 +61,17 @@ export class GameController {
|
||||
async reset(): Promise<GameEntity> {
|
||||
return new GameEntity(await this.gameService.reset())
|
||||
}
|
||||
|
||||
/**
|
||||
* Tente de réparer l'état du jeu
|
||||
* @remarks , Vérifie que tous les trains ont bien été payés et que tous les défis réussis sont bien accompagnés d'un crédit de points.
|
||||
*
|
||||
* @throws {401} Non authentifié⋅e
|
||||
*/
|
||||
@Put('/repair')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
async repair(): Promise<RepairGame> {
|
||||
return await this.gameService.repair()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user