Merge branch 'master' into hugo

This commit is contained in:
simplonco
2023-01-15 02:12:50 +01:00
8 changed files with 97 additions and 28 deletions

View File

@@ -200,8 +200,10 @@ export class GameService {
async declineInvitation(user : User, token : string, @Res() res : Response)
{
if (user.status !== STATUS.CONNECTED)
return res.status(HttpStatus.FORBIDDEN).json({message : "You must not be in game to decline an invitation"});
/* Luke: le check de user.status n'est pas fonctionnel avec l'implémentation des invitations dans le front.
Ça me semble dispensable, je désactive donc pour le moment plutôt que de refaire l'implémentation front. */
// if (user.status !== STATUS.CONNECTED)
// return res.status(HttpStatus.FORBIDDEN).json({message : "You must not be in game to decline an invitation"});
console.log("On décline l'invitation")
const tokenGame = await this.tokenGameRepository.createQueryBuilder('tokengame')
.andWhere('tokengame.playerTwoUsername = :playerTwoUsername', {playerTwoUsername : user.username})
@@ -236,8 +238,10 @@ export class GameService {
async acceptInvitation(user : User, token : string, @Res() res : Response)
{
if (user.status !== STATUS.CONNECTED)
return res.status(HttpStatus.FORBIDDEN).send("")
/* Luke: le check de user.status n'est pas fonctionnel avec l'implémentation des invitations dans le front.
Ça me semble dispensable, je désactive donc pour le moment plutôt que de refaire l'implémentation front. */
// if (user.status !== STATUS.CONNECTED)
// return res.status(HttpStatus.FORBIDDEN).send("")
const tokenGame = await this.tokenGameRepository.createQueryBuilder('tokenGame')
.andWhere('tokenGame.playerTwoUsername = :playerTwoUsername', {playerTwoUsername : user.username})
.andWhere('tokenGame.token = :token', {token : token})