From 1d80ebd11fad39124fcef4e480be8feb7e2c0dfb Mon Sep 17 00:00:00 2001 From: Noan07 <84435602+Noan07@users.noreply.github.com> Date: Thu, 16 Mar 2023 09:49:21 +0100 Subject: [PATCH] :hammer: CreatePlayer --- code/server/ApiLeapHit/Controllers/ChatsController.cs | 4 ++-- code/server/ApiLeapHit/Controllers/GamesController.cs | 2 +- code/server/ApiLeapHit/Controllers/PlayersController.cs | 8 ++++++-- code/server/ApiLeapHit/Mapper/GameMapper.cs | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/code/server/ApiLeapHit/Controllers/ChatsController.cs b/code/server/ApiLeapHit/Controllers/ChatsController.cs index 04eb037..6d0a5e7 100644 --- a/code/server/ApiLeapHit/Controllers/ChatsController.cs +++ b/code/server/ApiLeapHit/Controllers/ChatsController.cs @@ -108,7 +108,7 @@ namespace ApiLeapHit.Controllers [HttpGet("Player/{id}")] - public async Task>> GetChatsByIdPlayer(int id) + public async Task>> GetChatsByIdPlayer(string id) { try { @@ -135,7 +135,7 @@ namespace ApiLeapHit.Controllers } [HttpGet("Players/{idPlayer1}/{idPlayer2}")] - public async Task>> GetChatsByIdPlayers(int idPlayer1, int idPlayer2) + public async Task>> GetChatsByIdPlayers(string idPlayer1, string idPlayer2) { try { diff --git a/code/server/ApiLeapHit/Controllers/GamesController.cs b/code/server/ApiLeapHit/Controllers/GamesController.cs index 346a06f..1729120 100644 --- a/code/server/ApiLeapHit/Controllers/GamesController.cs +++ b/code/server/ApiLeapHit/Controllers/GamesController.cs @@ -95,7 +95,7 @@ namespace ApiLeapHit.Controllers //} [HttpGet("Player/{id}")] - public async Task>> GetGameByIdPlayer(int id) + public async Task>> GetGameByIdPlayer(string id) { try { diff --git a/code/server/ApiLeapHit/Controllers/PlayersController.cs b/code/server/ApiLeapHit/Controllers/PlayersController.cs index 86cc4a2..a835e97 100644 --- a/code/server/ApiLeapHit/Controllers/PlayersController.cs +++ b/code/server/ApiLeapHit/Controllers/PlayersController.cs @@ -22,11 +22,15 @@ namespace ApiLeapHit.Controllers _logger = logger; } - [HttpPost] - public async Task>> CreatePlayer() + [HttpGet("/clePlayer/{idIdentification}")] + public async Task>> CreatePlayer(string idIdentification) { try { + if(!idIdentification.Equals("K02q7naLzjmodzAFfoSO4mPydr7W5hydPMrHtA6D")) + { + return StatusCode((int)HttpStatusCode.NotFound, new ApiResponse("Le numéo n'est pas correct.")); + } var player = new Player(); string id; do diff --git a/code/server/ApiLeapHit/Mapper/GameMapper.cs b/code/server/ApiLeapHit/Mapper/GameMapper.cs index 1500e70..49674b0 100644 --- a/code/server/ApiLeapHit/Mapper/GameMapper.cs +++ b/code/server/ApiLeapHit/Mapper/GameMapper.cs @@ -14,8 +14,8 @@ namespace ApiLeapHit.Mapper nbMaxEchanges = game.nbMaxEchanges, playerWinner = game.winner, playerLoser = game.loser, - scoreLoser = game.loser, - scoreWinner = game.winner + scoreLoser = game.scoreLoser, + scoreWinner = game.scoreWinner }; return dtoGame; }