/resetuserstatus when player leave the gameserver

This commit is contained in:
lperrey
2023-01-12 19:52:28 +01:00
parent 20905b88de
commit 7e13dc3f61
5 changed files with 38 additions and 7 deletions

View File

@@ -101,4 +101,9 @@ export class GameController {
{
return this.gameService.destroySession(token);
}
@Post('gameserver/resetuserstatus')
async resetUserStatus(@Body('username') username){
this.gameService.resetStatus(username);
}
}

View File

@@ -300,5 +300,12 @@ export class GameService {
this.userService.updateStatus(playerTwo.id, STATUS.CONNECTED)
return HttpStatus.OK
}
async resetStatus(username : string){
const user : User = await this.userRepository.findOneBy({username : username})
if (!user)
return HttpStatus.NOT_FOUND;
this.userService.updateStatus(user.id, STATUS.CONNECTED);
}
}