/resetuserstatus when player leave the gameserver
This commit is contained in:
@@ -101,4 +101,9 @@ export class GameController {
|
||||
{
|
||||
return this.gameService.destroySession(token);
|
||||
}
|
||||
|
||||
@Post('gameserver/resetuserstatus')
|
||||
async resetUserStatus(@Body('username') username){
|
||||
this.gameService.resetStatus(username);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user