Suite du jeu et toujours pas fin
This commit is contained in:
@@ -6,6 +6,7 @@ import { User } from 'src/users/entities/user.entity';
|
||||
import { UsersService } from 'src/users/users.service';
|
||||
import { GrantTicketDto } from './dto/grantTicket.dto';
|
||||
import { ValidateTicketDto } from './dto/validateTicket.dto';
|
||||
import { TokenGame } from './entity/tokenGame.entity';
|
||||
import { GameService } from './game.service';
|
||||
|
||||
@Controller('game')
|
||||
@@ -25,13 +26,13 @@ export class GameController {
|
||||
return this.gameService.generateToken(user, grantTicketDto);
|
||||
}
|
||||
|
||||
@Get('requested')
|
||||
@Post('requested')
|
||||
@UseGuards(AuthenticateGuard)
|
||||
@UseGuards(TwoFactorGuard)
|
||||
async requestIfAnotherUserHasRespondToquestForGame(@Req() req, @Body('playerTwoUsername') body)
|
||||
async requestIfAnotherUserHasRespondToquestForGame(@Req() req, @Body('token') token)
|
||||
{
|
||||
const user : User = req.user;
|
||||
return this.gameService.requestIfAnotherUserHasRespondToquestForGame(user, body);
|
||||
return this.gameService.requestIfAnotherUserHasRespondToquestForGame(user, token);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ export class GameService {
|
||||
if (user.status === "In Game")
|
||||
return new HttpException("You can't do that.", HttpStatus.BAD_REQUEST)
|
||||
const tokenGame = await this.tokenGameRepository.createQueryBuilder('tokenGame')
|
||||
.andWhere('tokenGame.token = :token', {token : token})
|
||||
.where('tokenGame.token = :token', {token : token})
|
||||
.andWhere('tokenGame.isSecondUserAcceptedRequest = :isSecondUserAcceptedRequest', {isSecondUserAcceptedRequest : true})
|
||||
.getOne();
|
||||
if (tokenGame && tokenGame.isSecondUserAcceptedRequest === true)
|
||||
|
||||
Reference in New Issue
Block a user