Fix : add transaction
This commit is contained in:
@@ -82,20 +82,8 @@ export class GamesController {
|
||||
const currentTurn = game.teams.find(
|
||||
(t) => t._id.toHexString() == game.currentTurn,
|
||||
);
|
||||
if (!currentTurn.players.some((p) => p._id == player._id)) {
|
||||
throw new HttpException('It is not your turn', HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (
|
||||
!currentTurn.players.some(
|
||||
(p) => p._id.toHexString() == player._id.toHexString(),
|
||||
)
|
||||
) {
|
||||
throw new HttpException(
|
||||
'It is not your turn to play',
|
||||
HttpStatus.FORBIDDEN,
|
||||
);
|
||||
}
|
||||
await this.gameService.endTurn(game);
|
||||
|
||||
await this.gameService.endTurn(game, player._id.toHexString());
|
||||
}
|
||||
|
||||
@Sse('/subscribe')
|
||||
|
||||
Reference in New Issue
Block a user