Compare commits

..

No commits in common. "23081e022077e0168aa3acc4c6d0cb8aac9766ce" and "4c157ff67ff72484ec30753a3f58a11ccd8f0704" have entirely different histories.

4 changed files with 1 additions and 32 deletions

View File

@ -94,7 +94,7 @@ export class ChallengesController {
* *
* @throws {401} Non authentifiée * @throws {401} Non authentifiée
* @throws {404} Plus aucun défi n'est disponible * @throws {404} Plus aucun défi n'est disponible
* @throws {409} Un défi est déjà en cours d'accomplissement, ou bien vous n'êtes pas en course * @throws {409} Un défi est déjà en cours d'accomplissement
*/ */
@Post('/draw-random') @Post('/draw-random')
@UseGuards(JwtAuthGuard) @UseGuards(JwtAuthGuard)

View File

@ -61,9 +61,6 @@ export class ChallengesService {
} }
async drawRandom(player: Player): Promise<ChallengeEntity> { async drawRandom(player: Player): Promise<ChallengeEntity> {
const game = await this.prisma.game.findUnique({ where: { id: 1 } })
if (game.currentRunnerId != player.id)
throw new ConflictException("Vous n'êtes pas en course, ce n'est pas à vous de tirer un défi.")
const currentChallengeAction = await this.prisma.challengeAction.findFirst({ const currentChallengeAction = await this.prisma.challengeAction.findFirst({
where: { where: {
playerId: player.id, playerId: player.id,

View File

@ -35,18 +35,6 @@ export class GameController {
return new GameEntity(await this.gameService.start()) return new GameEntity(await this.gameService.start())
} }
/**
* Change de joueurse en course après une capture
*
* @throws {401} Non authentifiée
*/
@Post('/switch-running-player')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
async switchRunningPlayer(): Promise<GameEntity> {
return new GameEntity(await this.gameService.switchRunningPlayer())
}
/** /**
* Arrêter le jeu * Arrêter le jeu
* @remarks Arrête le jeu (si déjà lancé), à n'utiliser qu'en fin de partie. * @remarks Arrête le jeu (si déjà lancé), à n'utiliser qu'en fin de partie.

View File

@ -38,22 +38,6 @@ export class GameService {
}) })
} }
async switchRunningPlayer(): Promise<Game> {
const game = await this.find()
const newRunnerId = game.currentRunnerId == 1 ? 2 : 1
await this.prisma.moneyUpdate.create({
data: {
playerId: newRunnerId,
amount: 300,
reason: MoneyUpdateType.START,
}
})
return await this.prisma.game.update({
where: { id: game.id },
data: { currentRunnerId: newRunnerId },
})
}
async stop(): Promise<Game> { async stop(): Promise<Game> {
const game = await this.find() const game = await this.find()
if (!game.started) if (!game.started)