From dc6fea8bf6ef4794fc9eea0284ab0fbe649d2575 Mon Sep 17 00:00:00 2001 From: Damien NORTIER Date: Tue, 26 Mar 2024 17:36:52 +0100 Subject: [PATCH] suppression d'un bug --- .../Controllers/AdministratorController.cs | 59 +- .../WebApi/Controllers/ChapterController.cs | 66 +- WebApi/WebApi/Controllers/FrontController.cs | 1192 ++++++++--------- WebApi/WebApi/Controllers/LobbyController.cs | 39 +- WebApi/WebApi/Controllers/PlayerController.cs | 39 +- .../WebApi/Controllers/QuestionController.cs | 39 +- WebApi/WebApi/Program.cs | 3 + WebApi/WebApi/WebApi.csproj | 4 + WebApi/WebApi/database.db | Bin 0 -> 81920 bytes 9 files changed, 727 insertions(+), 714 deletions(-) create mode 100644 WebApi/WebApi/database.db diff --git a/WebApi/WebApi/Controllers/AdministratorController.cs b/WebApi/WebApi/Controllers/AdministratorController.cs index b6229a0..273c818 100644 --- a/WebApi/WebApi/Controllers/AdministratorController.cs +++ b/WebApi/WebApi/Controllers/AdministratorController.cs @@ -7,6 +7,7 @@ using ServiceManagers; using Microsoft.Extensions.Logging; using OrderCriterias; using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.AspNetCore.Components; namespace WebApi.Controllers { @@ -14,12 +15,12 @@ namespace WebApi.Controllers { private Unit unity; - private readonly Logger logger; + [Inject] + private Logger Logger { get; set; } - public AdministratorController(Unit unit, Logger logger) + public AdministratorController(Unit unit) { this.unity = unit; - this.logger = logger; } /// @@ -47,7 +48,7 @@ namespace WebApi.Controllers if(tmp.Username == administrator.Username) { // it was already in the database - logger.LogInformation(message: $"want to add an administrator already in the database : {tmp.ToString()}"); + Logger.LogInformation(message: $"want to add an administrator already in the database : {tmp.ToString()}"); return StatusCode(208, tmp); } else @@ -55,7 +56,7 @@ namespace WebApi.Controllers // we recieve an administrator already in the database // that should be equal to the administrator that we // wanted to add but it isn't - logger.LogCritical(message: "controller's add fail (already in the database) but\nadministrator" + + Logger.LogCritical(message: "controller's add fail (already in the database) but\nadministrator" + $" recieve isn't the same as the one we wanted to add.\n" + $"Administrator recieve : {tmp.ToString()}\nadministrator to add : {administrator.ToString()}"); return StatusCode(500); @@ -64,7 +65,7 @@ namespace WebApi.Controllers // added if (tmp.Username == administrator.Username) { - logger.LogTrace(message: $"administrator added : {tmp.ToString()}"); + Logger.LogTrace(message: $"administrator added : {tmp.ToString()}"); // the administrator has been added and we recieved him return StatusCode(202, tmp); } @@ -74,18 +75,18 @@ namespace WebApi.Controllers if (unity.getAdministratorByUsername(administrator.Username) != null) { // he is added - logger.LogError(message: $"administrator added but not recieved"); + Logger.LogError(message: $"administrator added but not recieved"); return Ok(); // not 202 to make a difference between 2 cases } else { // he is not added - logger.LogCritical(message: "administrator that we wanted to add not added\nand we have added another one"); + Logger.LogCritical(message: "administrator that we wanted to add not added\nand we have added another one"); if (unity.getAdministratorByUsername(administrator.Username) == null) // <=> not added return StatusCode(500); } } - logger.LogError(message: "this case should not append"); + Logger.LogError(message: "this case should not append"); return StatusCode(500); } @@ -113,17 +114,17 @@ namespace WebApi.Controllers var tmp = await unity.getAdministrators(page, count, orderCriteria); if (tmp.administrators == null) { - logger.LogInformation(message: "get admin : bad request (page or/and count incorrect)"); + Logger.LogInformation(message: "get admin : bad request (page or/and count incorrect)"); return BadRequest(tmp.nbPages); } else if (tmp.administrators.Count() == 0) { - logger.LogWarning(message: $"get admin : no content. number of element : {unity.getNbAdmins()}, page wanted : {page}, number of elements in a page : {count}"); + Logger.LogWarning(message: $"get admin : no content. number of element : {unity.getNbAdmins()}, page wanted : {page}, number of elements in a page : {count}"); return NoContent(); } else { - logger.LogTrace(message: $"get admins : page = {page}, count = {count}, order criteria = {orderCriteria switch + Logger.LogTrace(message: $"get admins : page = {page}, count = {count}, order criteria = {orderCriteria switch { AdministratorOrderCriteria.ById => "byId", AdministratorOrderCriteria.ByUserName => "byUsername", @@ -154,7 +155,7 @@ namespace WebApi.Controllers { if (id < 0) { - logger.LogError("want to delete an administrator with an id less than 0"); + Logger.LogError("want to delete an administrator with an id less than 0"); return BadRequest(); } int count = unity.getNbAdmins(); // count : number of elements before opperation @@ -165,12 +166,12 @@ namespace WebApi.Controllers { if (unity.getAdministrator(id) != null) { - logger.LogCritical(message: "remove administrator fail : administrator not removed and not recieved"); + Logger.LogCritical(message: "remove administrator fail : administrator not removed and not recieved"); return StatusCode(500); } else { - logger.LogInformation(message: "trying to remove an administrator with an id who don't exist"); + Logger.LogInformation(message: "trying to remove an administrator with an id who don't exist"); return BadRequest(); } } @@ -178,12 +179,12 @@ namespace WebApi.Controllers { if (unity.getAdministrator(id) == null) // he must be deleted { - logger.LogError(message: "administrator removed but not returned"); + Logger.LogError(message: "administrator removed but not returned"); return NoContent(); } else // he is not deleted { - logger.LogCritical(message: "remove administrator fail : administrator to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); + Logger.LogCritical(message: "remove administrator fail : administrator to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); return StatusCode(500); } } @@ -193,10 +194,10 @@ namespace WebApi.Controllers // <=> we have recieved an administrator which should be deleted // but since we have the same number of administrator than // before deletion, it isn't deleted - logger.LogCritical(message: $"administrator \"{tmp.ToString()}\"should be delete but it isn't"); + Logger.LogCritical(message: $"administrator \"{tmp.ToString()}\"should be delete but it isn't"); return StatusCode(500); } - logger.LogTrace(message: $"administrator removed {tmp.ToString()}"); + Logger.LogTrace(message: $"administrator removed {tmp.ToString()}"); return Ok(tmp); } @@ -223,7 +224,7 @@ namespace WebApi.Controllers var tmp = await unity.getAdministratorByUsername(administrator.Username); if (tmp != null) { - logger.LogTrace(message: "Want to modify into an administrator who already exist"); + Logger.LogTrace(message: "Want to modify into an administrator who already exist"); return StatusCode(StatusCodes.Status208AlreadyReported, tmp); } tmp = await unity.updateAdministrator(id, administrator); @@ -232,19 +233,19 @@ namespace WebApi.Controllers tmp = await unity.getAdministrator(id); if (tmp == null) // Ok, it don't exist { - logger.LogWarning(message: "Want to modify an administrator who don't exist"); + Logger.LogWarning(message: "Want to modify an administrator who don't exist"); return NoContent(); } else { if (tmp.Username == administrator.Username && tmp.HashedPassword == administrator.HashedPassword) { - logger.LogError(message: "Administrator changed but not recieved"); + Logger.LogError(message: "Administrator changed but not recieved"); return Ok(tmp); } else { - logger.LogCritical(message: "administrator haven't changed and we recieved nothing"); + Logger.LogCritical(message: "administrator haven't changed and we recieved nothing"); return StatusCode(500); } } @@ -254,16 +255,16 @@ namespace WebApi.Controllers if(tmp.HashedPassword == administrator.HashedPassword && tmp.Username == administrator.Username) // he is changed { - logger.LogTrace(message: $"administrator with id {id} modified in {administrator.ToString()}"); + Logger.LogTrace(message: $"administrator with id {id} modified in {administrator.ToString()}"); return Ok(tmp); } else // he haven't changed { var tmp2 = (await unity.getAdministratorByUsername(administrator.Username)); if(tmp2 != null) // it change another administrator - logger.LogCritical(message: "administrator should have changed but he haven't. Instead, another one changed"); + Logger.LogCritical(message: "administrator should have changed but he haven't. Instead, another one changed"); else // nothing have changed - logger.LogCritical(message: "administrator should have changed but he haven't and we recieved him"); + Logger.LogCritical(message: "administrator should have changed but he haven't and we recieved him"); return StatusCode(500); } } @@ -272,17 +273,17 @@ namespace WebApi.Controllers var tmp2 = await unity.getAdministrator(id); if (tmp2 == null) { // ok, he d'ont exist. - logger.LogError(message: "Want to modify an administrator who don't exist but recieved a random one"); + Logger.LogError(message: "Want to modify an administrator who don't exist but recieved a random one"); return NoContent(); } else if (tmp2.Username == administrator.Username && tmp2.HashedPassword == administrator.HashedPassword) { - logger.LogError(message: $"administrator modified but recieved a random one"); + Logger.LogError(message: $"administrator modified but recieved a random one"); return Ok(tmp2); } else { - logger.LogCritical(message: "administrator that we wanted to modify not modified"); + Logger.LogCritical(message: "administrator that we wanted to modify not modified"); return StatusCode(500); } } diff --git a/WebApi/WebApi/Controllers/ChapterController.cs b/WebApi/WebApi/Controllers/ChapterController.cs index 9b87c19..1d8f4e1 100644 --- a/WebApi/WebApi/Controllers/ChapterController.cs +++ b/WebApi/WebApi/Controllers/ChapterController.cs @@ -1,4 +1,5 @@ using DTOs; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Mvc; using OrderCriterias; @@ -6,14 +7,15 @@ namespace WebApi.Controllers { public class ChapterController : ControllerBase { - private Unit unity; - - private readonly Logger logger; - - public ChapterController(Unit unit, Logger logger) + private Unit unity; + + + [Inject] + private Logger Logger { get; set; } + + public ChapterController(Unit unit) { this.unity = unit; - this.logger = logger; } /// @@ -41,7 +43,7 @@ namespace WebApi.Controllers if (tmp.Name == chapter.Name) { // it was already in the database - logger.LogInformation(message: $"want to add a chapter already in the database : {tmp.ToString()}"); + Logger.LogInformation(message: $"want to add a chapter already in the database : {tmp.ToString()}"); return StatusCode(208, tmp); } else @@ -49,7 +51,7 @@ namespace WebApi.Controllers // we recieve a chapter already in the database // that should be equal to the chapter that we // wanted to add but it isn't - logger.LogCritical(message: "controller's add fail (already in the database) but\nchapter" + + Logger.LogCritical(message: "controller's add fail (already in the database) but\nchapter" + $" recieve isn't the same as the one we wanted to add.\n" + $"Chapter recieve : {tmp.ToString()}\nchapter to add : {chapter.ToString()}"); return StatusCode(500); @@ -58,7 +60,7 @@ namespace WebApi.Controllers // added if (tmp.Name == chapter.Name) { - logger.LogTrace(message: $"chapter added : {tmp.ToString()}"); + Logger.LogTrace(message: $"chapter added : {tmp.ToString()}"); // the chapter has been added and we recieved him return StatusCode(202, tmp); } @@ -68,18 +70,18 @@ namespace WebApi.Controllers if (unity.getChapter(chapter.Name) != null) { // he is added - logger.LogError(message: $"chapter added but not recieved"); + Logger.LogError(message: $"chapter added but not recieved"); return Ok(); // not 202 to make a difference between 2 cases } else { // he is not added - logger.LogCritical(message: "chapter that we wanted to add not added\nand we have added another one"); + Logger.LogCritical(message: "chapter that we wanted to add not added\nand we have added another one"); if (unity.getChapter(chapter.Name) == null) // <=> not added return StatusCode(500); } } - logger.LogError(message: "this case should not append"); + Logger.LogError(message: "this case should not append"); return StatusCode(500); } @@ -107,17 +109,17 @@ namespace WebApi.Controllers var tmp = await unity.getChapters(page, count, orderCriteria); if (tmp.chapters == null) { - logger.LogInformation(message: "get chapter : bad request (page or/and count incorrect)"); + Logger.LogInformation(message: "get chapter : bad request (page or/and count incorrect)"); return BadRequest(tmp.nbPages); } else if (tmp.chapters.Count() == 0) { - logger.LogWarning(message: $"get chapter : no content. number of element : {unity.getNbChapters()}, page wanted : {page}, number of elements in a page : {count}"); + Logger.LogWarning(message: $"get chapter : no content. number of element : {unity.getNbChapters()}, page wanted : {page}, number of elements in a page : {count}"); return NoContent(); } else { - logger.LogTrace(message: $"get chapters : page = {page}, count = {count}, order criteria = {orderCriteria switch + Logger.LogTrace(message: $"get chapters : page = {page}, count = {count}, order criteria = {orderCriteria switch { ChapterOrderCriteria.ById => "byId", ChapterOrderCriteria.ByName => "byName", @@ -148,7 +150,7 @@ namespace WebApi.Controllers { if (id < 0) { - logger.LogError("want to delete a chapter with an id less than 0"); + Logger.LogError("want to delete a chapter with an id less than 0"); return BadRequest(); } int count = unity.getNbChapters(); // count : number of elements before opperation @@ -159,12 +161,12 @@ namespace WebApi.Controllers { if (unity.getChapter(id) != null) { - logger.LogCritical(message: "remove chapter fail : chapter not removed and not recieved"); + Logger.LogCritical(message: "remove chapter fail : chapter not removed and not recieved"); return StatusCode(500); } else { - logger.LogInformation(message: "trying to remove a chapter with an id who don't exist"); + Logger.LogInformation(message: "trying to remove a chapter with an id who don't exist"); return BadRequest(); } } @@ -172,12 +174,12 @@ namespace WebApi.Controllers { if (unity.getChapter(id) == null) // he must be deleted { - logger.LogError(message: "chapter removed but not returned"); + Logger.LogError(message: "chapter removed but not returned"); return NoContent(); } else // he is not deleted { - logger.LogCritical(message: "remove chapter fail : chapter to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); + Logger.LogCritical(message: "remove chapter fail : chapter to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); return StatusCode(500); } } @@ -187,10 +189,10 @@ namespace WebApi.Controllers // <=> we have recieved a chapter which should be deleted // but since we have the same number of chapter than // before deletion, it isn't deleted - logger.LogCritical(message: $"chapter \"{tmp.ToString()}\"should be delete but it isn't"); + Logger.LogCritical(message: $"chapter \"{tmp.ToString()}\"should be delete but it isn't"); return StatusCode(500); } - logger.LogTrace(message: $"chapter removed {tmp.ToString()}"); + Logger.LogTrace(message: $"chapter removed {tmp.ToString()}"); return Ok(tmp); } @@ -217,7 +219,7 @@ namespace WebApi.Controllers var tmp = await unity.getChapter(chapter.Name); if (tmp != null) { - logger.LogTrace(message: "Want to modify into a chapter who already exist"); + Logger.LogTrace(message: "Want to modify into a chapter who already exist"); return StatusCode(StatusCodes.Status208AlreadyReported, tmp); } tmp = await unity.updateChapter(id, chapter.Name); @@ -226,19 +228,19 @@ namespace WebApi.Controllers tmp = await unity.getChapter(id); if (tmp == null) // Ok, it don't exist { - logger.LogWarning(message: "Want to modify a chapter who don't exist"); + Logger.LogWarning(message: "Want to modify a chapter who don't exist"); return NoContent(); } else { if (tmp.Name == chapter.Name) { - logger.LogError(message: "Chapter changed but not recieved"); + Logger.LogError(message: "Chapter changed but not recieved"); return Ok(tmp); } else { - logger.LogCritical(message: "chapter haven't changed and we recieved nothing"); + Logger.LogCritical(message: "chapter haven't changed and we recieved nothing"); return StatusCode(500); } } @@ -247,16 +249,16 @@ namespace WebApi.Controllers { if (tmp.Name == chapter.Name) // he is changed { - logger.LogTrace(message: $"chapter with id {id} modified in {chapter.ToString()}"); + Logger.LogTrace(message: $"chapter with id {id} modified in {chapter.ToString()}"); return Ok(tmp); } else // he haven't changed { var tmp2 = (await unity.getChapter(chapter.Name)); if (tmp2 != null) // it change another chapter - logger.LogCritical(message: "chapter should have changed but he haven't. Instead, another one changed"); + Logger.LogCritical(message: "chapter should have changed but he haven't. Instead, another one changed"); else // nothing have changed - logger.LogCritical(message: "chapter should have changed but he haven't and we recieved him"); + Logger.LogCritical(message: "chapter should have changed but he haven't and we recieved him"); return StatusCode(500); } } @@ -265,17 +267,17 @@ namespace WebApi.Controllers var tmp2 = await unity.getChapter(id); if (tmp2 == null) { // ok, he d'ont exist. - logger.LogError(message: "Want to modify a chapter who don't exist but recieved a random one"); + Logger.LogError(message: "Want to modify a chapter who don't exist but recieved a random one"); return NoContent(); } else if (tmp2.Name == chapter.Name) { - logger.LogError(message: $"chapter modified but recieved a random one"); + Logger.LogError(message: $"chapter modified but recieved a random one"); return Ok(tmp2); } else { - logger.LogCritical(message: "chapter that we wanted to modify not modified"); + Logger.LogCritical(message: "chapter that we wanted to modify not modified"); return StatusCode(500); } } diff --git a/WebApi/WebApi/Controllers/FrontController.cs b/WebApi/WebApi/Controllers/FrontController.cs index d8c7227..ce89fba 100644 --- a/WebApi/WebApi/Controllers/FrontController.cs +++ b/WebApi/WebApi/Controllers/FrontController.cs @@ -1,596 +1,596 @@ -using DataManagers; -using DbConnectionLibrairie; -using DTOs; -using EntityManagers; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using OrderCriterias; -using ServiceManagers; -using RouteAttribute = Microsoft.AspNetCore.Mvc.RouteAttribute; - -namespace WebApi.Controllers -{ - [ApiVersion("1.0")] - [Route("api/v{version:apiversion}")] - public class FrontController - { - [Inject] - public MyDbContext dbContext { get; set; } - - // all secondary controllers - private AdministratorController administratorController; - private ChapterController chapterController; - private LobbyController lobbyController; - private PlayerController playerController; - private QuestionController questionController; - - public FrontController( - Logger logAdmin, - Logger logChapter, - Logger logLobby, - Logger logPlayer, - Logger logQuestion - ) - { - var unity = new Unit( - new AdministratorServiceManager(new AdministratorDataManager(new AdministratorEntityManager(dbContext))), - new AnswerServiceManager(new AnswerDataManager(new AnswerEntityManager(dbContext))), - new ChapterServiceManager(new ChapterDataManager(new ChapterEntityManager(dbContext))), - new LobbyServiceManager(new LobbyDataManager(new LobbyEntityManager(dbContext))), - new PlayerServiceManager(new PlayerDataManager(new PlayerEntityManager(dbContext))), - new QuestionServiceManager(new QuestionDataManager(new QuestionEntityManager(dbContext))) - ); - administratorController = new AdministratorController(unity, logAdmin); - chapterController = new ChapterController(unity, logChapter); - lobbyController = new LobbyController(unity, logLobby); - playerController = new PlayerController(unity, logPlayer); - questionController = new QuestionController(unity, logQuestion); - } - - /// - /// add an administrator - /// - /// the administrator to add - /// - /// status code : - /// 200 if the administrator is added - /// 202 if the administrator is added - /// 208 if the administrator was already in the database - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// no content when status code = 200 - /// administrator added when status code = 202 - /// administrator already in the database that equals the one we wanted to add when status code = 208 - /// no content when status code = 500 - /// - [HttpPost("add/administrator/")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status202Accepted)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task PostAdministrator([FromBody] AdministratorDto administrator) - => await administratorController.PostAdministrator(administrator); - - /// - /// get a part of all administrators - /// - /// the actual page - /// number of T element in a page - /// the order criteria - /// - /// status code : - /// 200 if we got a set - /// 204 if we got an empty set - /// 400 if we got nothing - /// - /// return content : - /// a tuple of the number of page and - /// all administrators in the database for - /// the page nb if status code = 200 - /// the number of page for count element if status code = 204 - /// nothing if status code = 400 - /// - [HttpGet("administrators")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task GetSomeAdministrators([FromQuery] int page, int count = 10, - AdministratorOrderCriteria orderCriteria = AdministratorOrderCriteria.ById) - => await administratorController.GetSomeAdministrators(page, count, orderCriteria); - - /// - /// delete an administrator - /// - /// the id of the administrator to delete - /// - /// - /// status code : - /// 200 if the administrator is removed - /// 204 if the administrator is removed - /// 400 if the id is incorrect - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// aministrator deleted when status code = 200 - /// no content when status code = 204 - /// no content when status code = 400 - /// no content when status code = 500 - /// - [HttpDelete("delete/administrator")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task DeleteAdministrator([FromQuery] int id) - => await administratorController.DeleteAdministrator(id); - - /// - /// update an administrator - /// - /// id of the administrator to update - /// an administrator who contains all properties to change - /// - /// status code : - /// 200 if the administrator is modified - /// 204 if we wanted to modify an administrator who don't exist - /// 208 if the new username of the administrator is already used - /// 500 if there was an internal error that doesn't allow to continue - /// - /// return content : - /// the administrator modified when status code = 200 - /// nothing when status code = 204 - /// the administrator that already have the username when status code = 208 - /// nothing when status code = 500 - /// - [HttpPut("update/administrator")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task PutAdministrator([FromQuery] int id, [FromBody] AdministratorDto administrator) - => await administratorController.PutAdministrator(id, administrator); - - - - /// - /// add a chapter - /// - /// the chapter to add - /// - /// status code : - /// 200 if the chapter is added - /// 202 if the chapter is added - /// 208 if the chapter was already in the database - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// no content when status code = 200 - /// chapter added when status code = 202 - /// chapter already in the database that equals the one we wanted to add when status code = 208 - /// no content when status code = 500 - /// - [HttpPost("add/chapter")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status202Accepted)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task PostChapter([FromBody] ChapterDto chapter) - => await chapterController.PostChapter(chapter); - - /// - /// get a part of all chapters - /// - /// the actual page - /// number of T element in a page - /// the order criteria - /// - /// status code : - /// 200 if we got a set - /// 204 if we got an empty set - /// 400 if we got nothing - /// - /// return content : - /// a tuple of the number of page and - /// all chapters in the database for - /// the page nb if status code = 200 - /// the number of page for count element if status code = 204 - /// nothing if status code = 400 - /// - [HttpGet("all/chapter")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task GetSomeChapters([FromQuery] int page, int count = 10, ChapterOrderCriteria orderCriteria = ChapterOrderCriteria.ById) - => await chapterController.GetSomeChapters(page, count, orderCriteria); - - /// - /// delete a chapter - /// - /// the id of the chapter to delete - /// - /// - /// status code : - /// 200 if the chapter is removed - /// 204 if the chapter is removed - /// 400 if the id is incorrect - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// aministrator deleted when status code = 200 - /// no content when status code = 204 - /// no content when status code = 400 - /// no content when status code = 500 - /// - [HttpDelete("delete/chapter")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task DeleteChapter([FromQuery] int id) - => await chapterController.DeleteChapter(id); - - /// - /// update a chapter - /// - /// id of the chapter to update - /// a chapter who contains all properties to change - /// - /// status code : - /// 200 if the chapter is modified - /// 204 if we wanted to modify a chapter who don't exist - /// 208 if the new username of the chapter is already used - /// 500 if there was an internal error that doesn't allow to continue - /// - /// return content : - /// the chapter modified when status code = 200 - /// nothing when status code = 204 - /// the chapter that already have the username when status code = 208 - /// nothing when status code = 500 - /// - [HttpPut("update/chapter")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task PutChapter([FromQuery] int id, [FromBody] ChapterDto chapter) - => await chapterController.PutChapter(id, chapter); - - /// - /// get a chapter - /// - /// the name of the chapter - /// - /// status code : - /// 200 when we got a chapter - /// 204 when we got null - /// - /// return content : - /// the chapter that correspond to the name when status code = 200 - /// nothing when status code 204 - /// - [HttpGet("chapters/name")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task GetChapter([FromQuery] string name) - => await chapterController.GetChapter(name); - - /// - /// add a lobby - /// - /// the lobby to add - /// - /// status code : - /// 200 if the lobby is added - /// 202 if the lobby is added - /// 208 if the lobby was already in the database - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// no content when status code = 200 - /// lobby added when status code = 202 - /// lobby already in the database that equals the one we wanted to add when status code = 208 - /// no content when status code = 500 - /// - [HttpPost("add/lobby")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status202Accepted)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task PostLobby([FromBody] LobbyDto lobby) - => await lobbyController.PostLobby(lobby); - - /// - /// get a part of all lobbies - /// - /// the actual page - /// number of T element in a page - /// the order criteria - /// - /// status code : - /// 200 if we got a set - /// 204 if we got an empty set - /// 400 if we got nothing - /// - /// return content : - /// a tuple of the number of page and - /// all lobbies in the database for - /// the page nb if status code = 200 - /// the number of page for count element if status code = 204 - /// nothing if status code = 400 - /// - [HttpGet("lobbies")] - public async Task GetSomeLobbies([FromQuery] int page, int count = 10, LobbyOrderCriteria orderCriteria = LobbyOrderCriteria.ById) - => await lobbyController.GetSomeLobbies(page, count, orderCriteria); - - /// - /// delete a lobby - /// - /// the id of the lobby to delete - /// - /// - /// status code : - /// 200 if the lobby is removed - /// 204 if the lobby is removed - /// 400 if the id is incorrect - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// aministrator deleted when status code = 200 - /// no content when status code = 204 - /// no content when status code = 400 - /// no content when status code = 500 - /// - [HttpDelete("delete/lobby")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task DeleteLobby([FromQuery] int id) - => await lobbyController.DeleteLobby(id); - - /// - /// get a lobby - /// - /// the id of the lobby - /// - /// status code : - /// 200 when we got a lobby - /// 204 when we got null - /// - /// return content : - /// the lobby that correspond to the id when status code = 200 - /// nothing when status code 204 - /// - [HttpGet("lobbies/name")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task GetLobby(int id) - => await lobbyController.GetLobby(id); - - /// - /// add a player - /// - /// the player to add - /// - /// status code : - /// 200 if the player is added - /// 202 if the player is added - /// 208 if the player was already in the database - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// no content when status code = 200 - /// player added when status code = 202 - /// player already in the database that equals the one we wanted to add when status code = 208 - /// no content when status code = 500 - /// - [HttpPost("add/player")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status202Accepted)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task PostPlayer([FromBody] PlayerDto player) - => await playerController.PostPlayer(player); - - /// - /// get a part of all players - /// - /// the actual page - /// number of T element in a page - /// the order criteria - /// - /// status code : - /// 200 if we got a set - /// 204 if we got an empty set - /// 400 if we got nothing - /// - /// return content : - /// a tuple of the number of page and - /// all players in the database for - /// the page nb if status code = 200 - /// the number of page for count element if status code = 204 - /// nothing if status code = 400 - /// - [HttpGet("all/players")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task GetSomePlayers([FromQuery] int page, int count = 10, PlayerOrderCriteria orderCriteria = PlayerOrderCriteria.ById) - => await playerController.GetSomePlayers(page, count, orderCriteria); - - /// - /// delete a player - /// - /// the id of the player to delete - /// - /// - /// status code : - /// 200 if the player is removed - /// 204 if the player is removed - /// 400 if the id is incorrect - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// aministrator deleted when status code = 200 - /// no content when status code = 204 - /// no content when status code = 400 - /// no content when status code = 500 - /// - [HttpDelete("delete/player")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task DeletePlayer(int id) - => await playerController.DeletePlayer(id); - - /// - /// get a player - /// - /// the id of the player - /// - /// status code : - /// 200 when we got a player - /// 204 when we got null - /// - /// return content : - /// the player that correspond to the id when status code = 200 - /// nothing when status code = 204 - /// - [HttpGet("player")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task GetPlayer(int id) - => await playerController.GetPlayer(id); - - /// - /// update a player - /// - /// the id of the player - /// - /// status code : - /// 200 when we got a player - /// 204 when we got null - /// 208 when the nickname is already used - /// return content : - /// the player that correspond to the id when status code = 200 - /// nothing when status code = 204 - /// the player which have this nickname when status code = 208 - /// - [HttpPut("update/player")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - public async Task PutPlayer([FromQuery] int id, [FromBody] PlayerDto player) - => await playerController.PutPlayer(id, player); - - /// - /// add a question - /// - /// the question to add - /// - /// status code : - /// 200 if the question is added - /// 202 if the question is added - /// 208 if the question was already in the database - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// no content when status code = 200 - /// question added when status code = 202 - /// question already in the database that equals the one we wanted to add when status code = 208 - /// no content when status code = 500 - /// - [HttpPost("add/question")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status202Accepted)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task PostQuestion([FromBody] QuestionDto question) - => await questionController.PostQuestion(question); - - /// - /// get a part of all questions - /// - /// the actual page - /// number of T element in a page - /// the order criteria - /// - /// status code : - /// 200 if we got a set - /// 204 if we got an empty set - /// 400 if we got nothing - /// - /// return content : - /// a tuple of the number of page and - /// all questions in the database for - /// the page nb if status code = 200 - /// the number of page for count element if status code = 204 - /// nothing if status code = 400 - /// - [HttpGet("questions/all")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task GetSomeQuestions([FromQuery] int page, int count = 10, QuestionOrderCriteria orderCriteria = QuestionOrderCriteria.ById) - => await questionController.GetSomeQuestions(page, count, orderCriteria); - - /// - /// delete a question - /// - /// the id of the question to delete - /// - /// status code : - /// 200 if the question is removed - /// 204 if the question is removed - /// 400 if the id is incorrect - /// 500 if there was an internal error that doesn't allow to continue - /// return content : - /// aministrator deleted when status code = 200 - /// no content when status code = 204 - /// no content when status code = 400 - /// no content when status code = 500 - /// - [HttpDelete("delete/question")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task DeleteQuestion([FromQuery] int id) - => await questionController.DeleteQuestion(id); - - /// - /// get a question - /// - /// the id of the question - /// - /// status code : - /// 200 when we got a question - /// 204 when we got null - /// - /// return content : - /// the question that correspond to the id when status code = 200 - /// nothing when status code = 204 - /// - [HttpGet("question")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task GetQuestion([FromQuery] int id) - => await questionController.GetQuestion(id); - - /// - /// update a question - /// - /// the id of the question - /// - /// status code : - /// 200 when we got a question - /// 204 when we got null - /// 208 when the nickname is already used - /// return content : - /// the question that correspond to the id when status code = 200 - /// nothing when status code = 204 - /// the question which have this nickname when status code = 208 - /// - [HttpPut] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status208AlreadyReported)] - public async Task PutQuestion(int id, QuestionDto question) - => await questionController.PutQuestion(id, question); - - } -} +using DataManagers; +using DbConnectionLibrairie; +using DTOs; +using EntityManagers; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using OrderCriterias; +using ServiceManagers; +using RouteAttribute = Microsoft.AspNetCore.Mvc.RouteAttribute; + +namespace WebApi.Controllers +{ + /// + /// a controller just to separate route definition with route "documentation" + /// + [ApiVersion("1.0")] + [Route("api/v{version:apiversion}")] + [ApiController] + public class FrontController + { + + private Unit unity; + + // all secondary controllers + private AdministratorController administratorController; + private ChapterController chapterController; + private LobbyController lobbyController; + private PlayerController playerController; + private QuestionController questionController; + + public FrontController( + MyDbContext dbContext + ) + { + unity = new Unit( + new AdministratorServiceManager(new AdministratorDataManager(new AdministratorEntityManager(dbContext))), + new AnswerServiceManager(new AnswerDataManager(new AnswerEntityManager(dbContext))), + new ChapterServiceManager(new ChapterDataManager(new ChapterEntityManager(dbContext))), + new LobbyServiceManager(new LobbyDataManager(new LobbyEntityManager(dbContext))), + new PlayerServiceManager(new PlayerDataManager(new PlayerEntityManager(dbContext))), + new QuestionServiceManager(new QuestionDataManager(new QuestionEntityManager(dbContext))) + ); + administratorController = new AdministratorController(unity); + chapterController = new ChapterController(unity); + lobbyController = new LobbyController(unity); + playerController = new PlayerController(unity); + questionController = new QuestionController(unity); + } + + /// + /// add an administrator + /// + /// the administrator to add + /// + /// status code : + /// 200 if the administrator is added + /// 202 if the administrator is added + /// 208 if the administrator was already in the database + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// no content when status code = 200 + /// administrator added when status code = 202 + /// administrator already in the database that equals the one we wanted to add when status code = 208 + /// no content when status code = 500 + /// + [HttpPost("add/administrator/")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status202Accepted)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task PostAdministrator([FromBody] AdministratorDto administrator) + => await administratorController.PostAdministrator(administrator); + + /// + /// get a part of all administrators + /// + /// the actual page + /// number of T element in a page + /// the order criteria + /// + /// status code : + /// 200 if we got a set + /// 204 if we got an empty set + /// 400 if we got nothing + /// + /// return content : + /// a tuple of the number of page and + /// all administrators in the database for + /// the page nb if status code = 200 + /// the number of page for count element if status code = 204 + /// nothing if status code = 400 + /// + [HttpGet("administrators")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + public async Task GetSomeAdministrators([FromQuery] int page, int count = 10, + AdministratorOrderCriteria orderCriteria = AdministratorOrderCriteria.ById) + => await administratorController.GetSomeAdministrators(page, count, orderCriteria); + + /// + /// delete an administrator + /// + /// the id of the administrator to delete + /// + /// + /// status code : + /// 200 if the administrator is removed + /// 204 if the administrator is removed + /// 400 if the id is incorrect + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// aministrator deleted when status code = 200 + /// no content when status code = 204 + /// no content when status code = 400 + /// no content when status code = 500 + /// + [HttpDelete("delete/administrator")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task DeleteAdministrator([FromQuery] int id) + => await administratorController.DeleteAdministrator(id); + + /// + /// update an administrator + /// + /// id of the administrator to update + /// an administrator who contains all properties to change + /// + /// status code : + /// 200 if the administrator is modified + /// 204 if we wanted to modify an administrator who don't exist + /// 208 if the new username of the administrator is already used + /// 500 if there was an internal error that doesn't allow to continue + /// + /// return content : + /// the administrator modified when status code = 200 + /// nothing when status code = 204 + /// the administrator that already have the username when status code = 208 + /// nothing when status code = 500 + /// + [HttpPut("update/administrator")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task PutAdministrator([FromQuery] int id, [FromBody] AdministratorDto administrator) + => await administratorController.PutAdministrator(id, administrator); + + + + /// + /// add a chapter + /// + /// the chapter to add + /// + /// status code : + /// 200 if the chapter is added + /// 202 if the chapter is added + /// 208 if the chapter was already in the database + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// no content when status code = 200 + /// chapter added when status code = 202 + /// chapter already in the database that equals the one we wanted to add when status code = 208 + /// no content when status code = 500 + /// + [HttpPost("add/chapter")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status202Accepted)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task PostChapter([FromBody] ChapterDto chapter) + => await chapterController.PostChapter(chapter); + + /// + /// get a part of all chapters + /// + /// the actual page + /// number of T element in a page + /// the order criteria + /// + /// status code : + /// 200 if we got a set + /// 204 if we got an empty set + /// 400 if we got nothing + /// + /// return content : + /// a tuple of the number of page and + /// all chapters in the database for + /// the page nb if status code = 200 + /// the number of page for count element if status code = 204 + /// nothing if status code = 400 + /// + [HttpGet("all/chapter")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + public async Task GetSomeChapters([FromQuery] int page, int count = 10, ChapterOrderCriteria orderCriteria = ChapterOrderCriteria.ById) + => await chapterController.GetSomeChapters(page, count, orderCriteria); + + /// + /// delete a chapter + /// + /// the id of the chapter to delete + /// + /// + /// status code : + /// 200 if the chapter is removed + /// 204 if the chapter is removed + /// 400 if the id is incorrect + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// aministrator deleted when status code = 200 + /// no content when status code = 204 + /// no content when status code = 400 + /// no content when status code = 500 + /// + [HttpDelete("delete/chapter")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task DeleteChapter([FromQuery] int id) + => await chapterController.DeleteChapter(id); + + /// + /// update a chapter + /// + /// id of the chapter to update + /// a chapter who contains all properties to change + /// + /// status code : + /// 200 if the chapter is modified + /// 204 if we wanted to modify a chapter who don't exist + /// 208 if the new username of the chapter is already used + /// 500 if there was an internal error that doesn't allow to continue + /// + /// return content : + /// the chapter modified when status code = 200 + /// nothing when status code = 204 + /// the chapter that already have the username when status code = 208 + /// nothing when status code = 500 + /// + [HttpPut("update/chapter")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task PutChapter([FromQuery] int id, [FromBody] ChapterDto chapter) + => await chapterController.PutChapter(id, chapter); + + /// + /// get a chapter + /// + /// the name of the chapter + /// + /// status code : + /// 200 when we got a chapter + /// 204 when we got null + /// + /// return content : + /// the chapter that correspond to the name when status code = 200 + /// nothing when status code 204 + /// + [HttpGet("chapters/name")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + public async Task GetChapter([FromQuery] string name) + => await chapterController.GetChapter(name); + + /// + /// add a lobby + /// + /// the lobby to add + /// + /// status code : + /// 200 if the lobby is added + /// 202 if the lobby is added + /// 208 if the lobby was already in the database + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// no content when status code = 200 + /// lobby added when status code = 202 + /// lobby already in the database that equals the one we wanted to add when status code = 208 + /// no content when status code = 500 + /// + [HttpPost("add/lobby")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status202Accepted)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task PostLobby([FromBody] LobbyDto lobby) + => await lobbyController.PostLobby(lobby); + + /// + /// get a part of all lobbies + /// + /// the actual page + /// number of T element in a page + /// the order criteria + /// + /// status code : + /// 200 if we got a set + /// 204 if we got an empty set + /// 400 if we got nothing + /// + /// return content : + /// a tuple of the number of page and + /// all lobbies in the database for + /// the page nb if status code = 200 + /// the number of page for count element if status code = 204 + /// nothing if status code = 400 + /// + [HttpGet("lobbies")] + public async Task GetSomeLobbies([FromQuery] int page, int count = 10, LobbyOrderCriteria orderCriteria = LobbyOrderCriteria.ById) + => await lobbyController.GetSomeLobbies(page, count, orderCriteria); + + /// + /// delete a lobby + /// + /// the id of the lobby to delete + /// + /// + /// status code : + /// 200 if the lobby is removed + /// 204 if the lobby is removed + /// 400 if the id is incorrect + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// aministrator deleted when status code = 200 + /// no content when status code = 204 + /// no content when status code = 400 + /// no content when status code = 500 + /// + [HttpDelete("delete/lobby")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task DeleteLobby([FromQuery] int id) + => await lobbyController.DeleteLobby(id); + + /// + /// get a lobby + /// + /// the id of the lobby + /// + /// status code : + /// 200 when we got a lobby + /// 204 when we got null + /// + /// return content : + /// the lobby that correspond to the id when status code = 200 + /// nothing when status code 204 + /// + [HttpGet("lobbies/name")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + public async Task GetLobby(int id) + => await lobbyController.GetLobby(id); + + /// + /// add a player + /// + /// the player to add + /// + /// status code : + /// 200 if the player is added + /// 202 if the player is added + /// 208 if the player was already in the database + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// no content when status code = 200 + /// player added when status code = 202 + /// player already in the database that equals the one we wanted to add when status code = 208 + /// no content when status code = 500 + /// + [HttpPost("add/player")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status202Accepted)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task PostPlayer([FromBody] PlayerDto player) + => await playerController.PostPlayer(player); + + /// + /// get a part of all players + /// + /// the actual page + /// number of T element in a page + /// the order criteria + /// + /// status code : + /// 200 if we got a set + /// 204 if we got an empty set + /// 400 if we got nothing + /// + /// return content : + /// a tuple of the number of page and + /// all players in the database for + /// the page nb if status code = 200 + /// the number of page for count element if status code = 204 + /// nothing if status code = 400 + /// + [HttpGet("all/players")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task GetSomePlayers([FromQuery] int page, int count = 10, PlayerOrderCriteria orderCriteria = PlayerOrderCriteria.ById) + => await playerController.GetSomePlayers(page, count, orderCriteria); + + /// + /// delete a player + /// + /// the id of the player to delete + /// + /// + /// status code : + /// 200 if the player is removed + /// 204 if the player is removed + /// 400 if the id is incorrect + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// aministrator deleted when status code = 200 + /// no content when status code = 204 + /// no content when status code = 400 + /// no content when status code = 500 + /// + [HttpDelete("delete/player")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task DeletePlayer(int id) + => await playerController.DeletePlayer(id); + + /// + /// get a player + /// + /// the id of the player + /// + /// status code : + /// 200 when we got a player + /// 204 when we got null + /// + /// return content : + /// the player that correspond to the id when status code = 200 + /// nothing when status code = 204 + /// + [HttpGet("player")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + public async Task GetPlayer(int id) + => await playerController.GetPlayer(id); + + /// + /// update a player + /// + /// the id of the player + /// + /// status code : + /// 200 when we got a player + /// 204 when we got null + /// 208 when the nickname is already used + /// return content : + /// the player that correspond to the id when status code = 200 + /// nothing when status code = 204 + /// the player which have this nickname when status code = 208 + /// + [HttpPut("update/player")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + public async Task PutPlayer([FromQuery] int id, [FromBody] PlayerDto player) + => await playerController.PutPlayer(id, player); + + /// + /// add a question + /// + /// the question to add + /// + /// status code : + /// 200 if the question is added + /// 202 if the question is added + /// 208 if the question was already in the database + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// no content when status code = 200 + /// question added when status code = 202 + /// question already in the database that equals the one we wanted to add when status code = 208 + /// no content when status code = 500 + /// + [HttpPost("add/question")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status202Accepted)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task PostQuestion([FromBody] QuestionDto question) + => await questionController.PostQuestion(question); + + /// + /// get a part of all questions + /// + /// the actual page + /// number of T element in a page + /// the order criteria + /// + /// status code : + /// 200 if we got a set + /// 204 if we got an empty set + /// 400 if we got nothing + /// + /// return content : + /// a tuple of the number of page and + /// all questions in the database for + /// the page nb if status code = 200 + /// the number of page for count element if status code = 204 + /// nothing if status code = 400 + /// + [HttpGet("questions/all")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + public async Task GetSomeQuestions([FromQuery] int page, int count = 10, QuestionOrderCriteria orderCriteria = QuestionOrderCriteria.ById) + => await questionController.GetSomeQuestions(page, count, orderCriteria); + + /// + /// delete a question + /// + /// the id of the question to delete + /// + /// status code : + /// 200 if the question is removed + /// 204 if the question is removed + /// 400 if the id is incorrect + /// 500 if there was an internal error that doesn't allow to continue + /// return content : + /// aministrator deleted when status code = 200 + /// no content when status code = 204 + /// no content when status code = 400 + /// no content when status code = 500 + /// + [HttpDelete("delete/question")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task DeleteQuestion([FromQuery] int id) + => await questionController.DeleteQuestion(id); + + /// + /// get a question + /// + /// the id of the question + /// + /// status code : + /// 200 when we got a question + /// 204 when we got null + /// + /// return content : + /// the question that correspond to the id when status code = 200 + /// nothing when status code = 204 + /// + [HttpGet("question")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + public async Task GetQuestion([FromQuery] int id) + => await questionController.GetQuestion(id); + + /// + /// update a question + /// + /// the id of the question + /// + /// status code : + /// 200 when we got a question + /// 204 when we got null + /// 208 when the nickname is already used + /// return content : + /// the question that correspond to the id when status code = 200 + /// nothing when status code = 204 + /// the question which have this nickname when status code = 208 + /// + [HttpPut] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status208AlreadyReported)] + public async Task PutQuestion(int id, QuestionDto question) + => await questionController.PutQuestion(id, question); + + } +} diff --git a/WebApi/WebApi/Controllers/LobbyController.cs b/WebApi/WebApi/Controllers/LobbyController.cs index a3bb4d8..8e9025a 100644 --- a/WebApi/WebApi/Controllers/LobbyController.cs +++ b/WebApi/WebApi/Controllers/LobbyController.cs @@ -1,4 +1,5 @@ using DTOs; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Mvc; using OrderCriterias; @@ -8,12 +9,12 @@ namespace WebApi.Controllers { private Unit unity; - private readonly Logger logger; + [Inject] + private Logger Logger { get; set; } - public LobbyController(Unit unit, Logger logger) + public LobbyController(Unit unit) { this.unity = unit; - this.logger = logger; } /// @@ -41,7 +42,7 @@ namespace WebApi.Controllers if (tmp.Name == lobby.Name) { // it was already in the database - logger.LogInformation(message: $"want to add a lobby already in the database : {tmp.ToString()}"); + Logger.LogInformation(message: $"want to add a lobby already in the database : {tmp.ToString()}"); return StatusCode(208, tmp); } else @@ -49,7 +50,7 @@ namespace WebApi.Controllers // we recieve a lobby already in the database // that should be equal to the lobby that we // wanted to add but it isn't - logger.LogCritical(message: "controller's add fail (already in the database) but\nlobby" + + Logger.LogCritical(message: "controller's add fail (already in the database) but\nlobby" + $" recieve isn't the same as the one we wanted to add.\n" + $"Lobby recieve : {tmp.ToString()}\nlobby to add : {lobby.ToString()}"); return StatusCode(500); @@ -58,7 +59,7 @@ namespace WebApi.Controllers // added if (tmp.Name == lobby.Name) { - logger.LogTrace(message: $"lobby added : {tmp.ToString()}"); + Logger.LogTrace(message: $"lobby added : {tmp.ToString()}"); // the lobby has been added and we recieved him return StatusCode(202, tmp); } @@ -70,13 +71,13 @@ namespace WebApi.Controllers if (unity.getLobby(lobby.Name, lobby.IdCreator) != null) { // he is added - logger.LogError(message: $"lobby added but not recieved"); + Logger.LogError(message: $"lobby added but not recieved"); return Ok(); // not 202 to make a difference between 2 cases } else { // he is not added - logger.LogCritical(message: "lobby that we wanted to add not added\nand we have added another one"); + Logger.LogCritical(message: "lobby that we wanted to add not added\nand we have added another one"); if (unity.getLobby(lobby.Name, lobby.IdCreator) == null) // <=> not added return StatusCode(500); } @@ -86,7 +87,7 @@ namespace WebApi.Controllers return StatusCode(500); } } - logger.LogError(message: "this case should not append"); + Logger.LogError(message: "this case should not append"); return StatusCode(500); } @@ -114,17 +115,17 @@ namespace WebApi.Controllers var tmp = await unity.getLobbies(page, count, orderCriteria); if (tmp.lobbies == null) { - logger.LogInformation(message: "get lobby : bad request (page or/and count incorrect)"); + Logger.LogInformation(message: "get lobby : bad request (page or/and count incorrect)"); return BadRequest(tmp.nbPages); } else if (tmp.lobbies.Count() == 0) { - logger.LogWarning(message: $"get lobby : no content. number of element : {unity.getNbLobbies()}, page wanted : {page}, number of elements in a page : {count}"); + Logger.LogWarning(message: $"get lobby : no content. number of element : {unity.getNbLobbies()}, page wanted : {page}, number of elements in a page : {count}"); return NoContent(); } else { - logger.LogTrace(message: $"get lobbies : page = {page}, count = {count}, order criteria = {orderCriteria switch + Logger.LogTrace(message: $"get lobbies : page = {page}, count = {count}, order criteria = {orderCriteria switch { LobbyOrderCriteria.ById => "byId", LobbyOrderCriteria.ByName => "byName", @@ -155,7 +156,7 @@ namespace WebApi.Controllers { if (id < 0) { - logger.LogError("want to delete a lobby with an id less than 0"); + Logger.LogError("want to delete a lobby with an id less than 0"); return BadRequest(); } int count = unity.getNbLobbies(); // count : number of elements before opperation @@ -166,12 +167,12 @@ namespace WebApi.Controllers { if (unity.getLobby(id) != null) { - logger.LogCritical(message: "remove lobby fail : lobby not removed and not recieved"); + Logger.LogCritical(message: "remove lobby fail : lobby not removed and not recieved"); return StatusCode(500); } else { - logger.LogInformation(message: "trying to remove a lobby with an id who don't exist"); + Logger.LogInformation(message: "trying to remove a lobby with an id who don't exist"); return BadRequest(); } } @@ -179,12 +180,12 @@ namespace WebApi.Controllers { if (unity.getLobby(id) == null) // he must be deleted { - logger.LogError(message: "lobby removed but not returned"); + Logger.LogError(message: "lobby removed but not returned"); return NoContent(); } else // he is not deleted { - logger.LogCritical(message: "remove lobby fail : lobby to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); + Logger.LogCritical(message: "remove lobby fail : lobby to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); return StatusCode(500); } } @@ -194,10 +195,10 @@ namespace WebApi.Controllers // <=> we have recieved a lobby which should be deleted // but since we have the same number of lobby than // before deletion, it isn't deleted - logger.LogCritical(message: $"lobby \"{tmp.ToString()}\"should be delete but it isn't"); + Logger.LogCritical(message: $"lobby \"{tmp.ToString()}\"should be delete but it isn't"); return StatusCode(500); } - logger.LogTrace(message: $"lobby removed {tmp.ToString()}"); + Logger.LogTrace(message: $"lobby removed {tmp.ToString()}"); return Ok(tmp); } diff --git a/WebApi/WebApi/Controllers/PlayerController.cs b/WebApi/WebApi/Controllers/PlayerController.cs index fcd2f0f..04df94f 100644 --- a/WebApi/WebApi/Controllers/PlayerController.cs +++ b/WebApi/WebApi/Controllers/PlayerController.cs @@ -1,4 +1,5 @@ using DTOs; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Mvc; using OrderCriterias; @@ -8,12 +9,12 @@ namespace WebApi.Controllers { private Unit unity; - private readonly Logger logger; + [Inject] + private Logger Logger { get; set; } - public PlayerController(Unit unit, Logger logger) + public PlayerController(Unit unit) { this.unity = unit; - this.logger = logger; } /// @@ -41,7 +42,7 @@ namespace WebApi.Controllers if (tmp.Nickname == player.Nickname) { // it was already in the database - logger.LogInformation(message: $"want to add a player already in the database : {tmp.ToString()}"); + Logger.LogInformation(message: $"want to add a player already in the database : {tmp.ToString()}"); return StatusCode(208, tmp); } else @@ -49,7 +50,7 @@ namespace WebApi.Controllers // we recieve a player already in the database // that should be equal to the player that we // wanted to add but it isn't - logger.LogCritical(message: "controller's add fail (already in the database) but\nplayer" + + Logger.LogCritical(message: "controller's add fail (already in the database) but\nplayer" + $" recieve isn't the same as the one we wanted to add.\n" + $"Player recieve : {tmp.ToString()}\nplayer to add : {player.ToString()}"); return StatusCode(500); @@ -58,7 +59,7 @@ namespace WebApi.Controllers // added if (tmp.Nickname == player.Nickname) { - logger.LogTrace(message: $"player added : {tmp.ToString()}"); + Logger.LogTrace(message: $"player added : {tmp.ToString()}"); // the player has been added and we recieved him return StatusCode(202, tmp); } @@ -70,13 +71,13 @@ namespace WebApi.Controllers if (unity.getPlayer(player.Nickname) != null) { // he is added - logger.LogError(message: $"player added but not recieved"); + Logger.LogError(message: $"player added but not recieved"); return Ok(); // not 202 to make a difference between 2 cases } else { // he is not added - logger.LogCritical(message: "player that we wanted to add not added\nand we have added another one"); + Logger.LogCritical(message: "player that we wanted to add not added\nand we have added another one"); if (unity.getPlayer(player.Nickname) == null) // <=> not added return StatusCode(500); } @@ -86,7 +87,7 @@ namespace WebApi.Controllers return StatusCode(500); } } - logger.LogError(message: "this case should not append"); + Logger.LogError(message: "this case should not append"); return StatusCode(500); } @@ -114,17 +115,17 @@ namespace WebApi.Controllers var tmp = await unity.getPlayers(page, count, orderCriteria); if (tmp.players == null) { - logger.LogInformation(message: "get player : bad request (page or/and count incorrect)"); + Logger.LogInformation(message: "get player : bad request (page or/and count incorrect)"); return BadRequest(tmp.nbPages); } else if (tmp.players.Count() == 0) { - logger.LogWarning(message: $"get player : no content. number of element : {unity.getNbPlayers()}, page wanted : {page}, number of elements in a page : {count}"); + Logger.LogWarning(message: $"get player : no content. number of element : {unity.getNbPlayers()}, page wanted : {page}, number of elements in a page : {count}"); return NoContent(); } else { - logger.LogTrace(message: $"get players : page = {page}, count = {count}, order criteria = {orderCriteria switch + Logger.LogTrace(message: $"get players : page = {page}, count = {count}, order criteria = {orderCriteria switch { PlayerOrderCriteria.ById => "byId", PlayerOrderCriteria.ByNickname => "byNickname", @@ -155,7 +156,7 @@ namespace WebApi.Controllers { if (id < 0) { - logger.LogError("want to delete a player with an id less than 0"); + Logger.LogError("want to delete a player with an id less than 0"); return BadRequest(); } int count = unity.getNbPlayers(); // count : number of elements before opperation @@ -166,12 +167,12 @@ namespace WebApi.Controllers { if (unity.getPlayer(id) != null) { - logger.LogCritical(message: "remove player fail : player not removed and not recieved"); + Logger.LogCritical(message: "remove player fail : player not removed and not recieved"); return StatusCode(500); } else { - logger.LogInformation(message: "trying to remove a player with an id who don't exist"); + Logger.LogInformation(message: "trying to remove a player with an id who don't exist"); return BadRequest(); } } @@ -179,12 +180,12 @@ namespace WebApi.Controllers { if (unity.getPlayer(id) == null) // he must be deleted { - logger.LogError(message: "player removed but not returned"); + Logger.LogError(message: "player removed but not returned"); return NoContent(); } else // he is not deleted { - logger.LogCritical(message: "remove player fail : player to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); + Logger.LogCritical(message: "remove player fail : player to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); return StatusCode(500); } } @@ -194,10 +195,10 @@ namespace WebApi.Controllers // <=> we have recieved a player which should be deleted // but since we have the same number of player than // before deletion, it isn't deleted - logger.LogCritical(message: $"player \"{tmp.ToString()}\"should be delete but it isn't"); + Logger.LogCritical(message: $"player \"{tmp.ToString()}\"should be delete but it isn't"); return StatusCode(500); } - logger.LogTrace(message: $"player removed {tmp.ToString()}"); + Logger.LogTrace(message: $"player removed {tmp.ToString()}"); return Ok(tmp); } diff --git a/WebApi/WebApi/Controllers/QuestionController.cs b/WebApi/WebApi/Controllers/QuestionController.cs index 245b9b7..f1b7b88 100644 --- a/WebApi/WebApi/Controllers/QuestionController.cs +++ b/WebApi/WebApi/Controllers/QuestionController.cs @@ -1,4 +1,5 @@ using DTOs; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Mvc; using OrderCriterias; @@ -8,12 +9,12 @@ namespace WebApi.Controllers { private Unit unity; - private readonly Logger logger; + [Inject] + private Logger Logger { get; set; } - public QuestionController(Unit unit, Logger logger) + public QuestionController(Unit unit) { this.unity = unit; - this.logger = logger; } /// @@ -41,7 +42,7 @@ namespace WebApi.Controllers if (tmp.Content == question.Content) { // it was already in the database - logger.LogInformation(message: $"want to add a question already in the database : {tmp.ToString()}"); + Logger.LogInformation(message: $"want to add a question already in the database : {tmp.ToString()}"); return StatusCode(208, tmp); } else @@ -49,7 +50,7 @@ namespace WebApi.Controllers // we recieve a question already in the database // that should be equal to the question that we // wanted to add but it isn't - logger.LogCritical(message: "controller's add fail (already in the database) but\nquestion" + + Logger.LogCritical(message: "controller's add fail (already in the database) but\nquestion" + $" recieve isn't the same as the one we wanted to add.\n" + $"Question recieve : {tmp.ToString()}\nquestion to add : {question.ToString()}"); return StatusCode(500); @@ -58,7 +59,7 @@ namespace WebApi.Controllers // added if (tmp.Content == question.Content) { - logger.LogTrace(message: $"question added : {tmp.ToString()}"); + Logger.LogTrace(message: $"question added : {tmp.ToString()}"); // the question has been added and we recieved him return StatusCode(202, tmp); } @@ -70,13 +71,13 @@ namespace WebApi.Controllers if (unity.getQuestion(question.Content) != null) { // he is added - logger.LogError(message: $"question added but not recieved"); + Logger.LogError(message: $"question added but not recieved"); return Ok(); // not 202 to make a difference between 2 cases } else { // he is not added - logger.LogCritical(message: "question that we wanted to add not added\nand we have added another one"); + Logger.LogCritical(message: "question that we wanted to add not added\nand we have added another one"); if (unity.getQuestion(question.Content) == null) // <=> not added return StatusCode(500); } @@ -86,7 +87,7 @@ namespace WebApi.Controllers return StatusCode(500); } } - logger.LogError(message: "this case should not append"); + Logger.LogError(message: "this case should not append"); return StatusCode(500); } @@ -114,17 +115,17 @@ namespace WebApi.Controllers var tmp = await unity.getQuestions(page, count, orderCriteria); if (tmp.questions == null) { - logger.LogInformation(message: "get question : bad request (page or/and count incorrect)"); + Logger.LogInformation(message: "get question : bad request (page or/and count incorrect)"); return BadRequest(tmp.nbPages); } else if (tmp.questions.Count() == 0) { - logger.LogWarning(message: $"get question : no content. number of element : {unity.getNbQuestions()}, page wanted : {page}, number of elements in a page : {count}"); + Logger.LogWarning(message: $"get question : no content. number of element : {unity.getNbQuestions()}, page wanted : {page}, number of elements in a page : {count}"); return NoContent(); } else { - logger.LogTrace(message: $"get questions : page = {page}, count = {count}, order criteria = {orderCriteria switch + Logger.LogTrace(message: $"get questions : page = {page}, count = {count}, order criteria = {orderCriteria switch { QuestionOrderCriteria.ById => "byId", QuestionOrderCriteria.ByContent => "byContent", @@ -157,7 +158,7 @@ namespace WebApi.Controllers { if (id < 0) { - logger.LogError("want to delete a question with an id less than 0"); + Logger.LogError("want to delete a question with an id less than 0"); return BadRequest(); } int count = unity.getNbQuestions(); // count : number of elements before opperation @@ -168,12 +169,12 @@ namespace WebApi.Controllers { if (unity.getQuestion(id) != null) { - logger.LogCritical(message: "remove question fail : question not removed and not recieved"); + Logger.LogCritical(message: "remove question fail : question not removed and not recieved"); return StatusCode(500); } else { - logger.LogInformation(message: "trying to remove a question with an id who don't exist"); + Logger.LogInformation(message: "trying to remove a question with an id who don't exist"); return BadRequest(); } } @@ -181,12 +182,12 @@ namespace WebApi.Controllers { if (unity.getQuestion(id) == null) // he must be deleted { - logger.LogError(message: "question removed but not returned"); + Logger.LogError(message: "question removed but not returned"); return NoContent(); } else // he is not deleted { - logger.LogCritical(message: "remove question fail : question to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); + Logger.LogCritical(message: "remove question fail : question to remove not remove\ninstead, anotherone is deleted and we recieved nothing"); return StatusCode(500); } } @@ -196,10 +197,10 @@ namespace WebApi.Controllers // <=> we have recieved a question which should be deleted // but since we have the same number of question than // before deletion, it isn't deleted - logger.LogCritical(message: $"question \"{tmp.ToString()}\"should be delete but it isn't"); + Logger.LogCritical(message: $"question \"{tmp.ToString()}\"should be delete but it isn't"); return StatusCode(500); } - logger.LogTrace(message: $"question removed {tmp.ToString()}"); + Logger.LogTrace(message: $"question removed {tmp.ToString()}"); return Ok(tmp); } diff --git a/WebApi/WebApi/Program.cs b/WebApi/WebApi/Program.cs index 1523393..d0d70fe 100644 --- a/WebApi/WebApi/Program.cs +++ b/WebApi/WebApi/Program.cs @@ -1,4 +1,7 @@ +using DbConnectionLibrairie; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; +using WebApi.Controllers; var builder = WebApplication.CreateBuilder(args); diff --git a/WebApi/WebApi/WebApi.csproj b/WebApi/WebApi/WebApi.csproj index d02907f..8887aa1 100644 --- a/WebApi/WebApi/WebApi.csproj +++ b/WebApi/WebApi/WebApi.csproj @@ -8,6 +8,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/WebApi/WebApi/database.db b/WebApi/WebApi/database.db new file mode 100644 index 0000000000000000000000000000000000000000..35ca7ad23f04612af5c4d52db4a96c6de3e267ea GIT binary patch literal 81920 zcmeI*&u$Y(9Kdm}19oC!447zDA;fm2s#wqvhtd>PYU?_iU^Q`qW2!^~Sx&quRuj8; z9RY_P5-5F!@(z`%zCsT@x3@k(FKv&l)MID=?|Qw^2=&0~YbDs8-I?FaXMQv5B@t}g zUg-{XWw$@rZx5C0sWYi`I`y%lq*AH0_&zVb-A6&ZIN`n#&r;xZ+{<)ocK7#u;h$7d zx|=%vOX0ixpZVw0e@|b@{W$q+?s-<4{Nd!!6F*JdP5+htHmykCi_;SGXcRN@m7;Xe z?RE4=wawNYLvPhO>wE3T`arxsUu|fWrl!>Di`u55j+~$>Yjs5xr>V+i)vcwLdgrq8 z%}dhZS+~*K2f8ur_IrkCx_ZC;hFa>L&dLiSPTq}UkI#(bdO0P9 zNTBGcb|k0Vj^wtYmY!zwS^3f>>6?4Q_V%9c9x%KYr=1AR$|ozDqI%_`p?ppe50PW4 zNX4eMtTmMST2ratSy@r4YxRw0qaw-`b^X&;pxSz)wpwXyDW7UvO65*-tyUKiR<(Nb zs?%Pz-y7<^p{g{sP0^auqI-0)ySv-nIoKPD$r+96o>SjmYVYkC@h5m0A2>zy+O1#f z*ji?Sjy)qdx~0JATE2d;g{8HIR$H!HLpIlB;8;m%XiHi{t5>xRMRls%lcbiM{=`Oe z7F%EitIB9BZ$X9vxi#HL`CRGfo$0K6;ezzEY-NJe73V1*&H}%m$H)P%(ko_wzX<-z z+&EGF3=AxysFs_jYIt7UVv$nj{HZ13^<*}em5W8`S=I6q8?N{|6?U?BVb921?Jr1M zZ?ld~?A7+8jh+5LZ0#|rA50ao?5y}fZnO7xFRq#k*WBauL0qDV+AV+IaymbnUv_br z%cIO@`;&Pib$;ql<9#s^?V-PSV(GUcJ397WLQ* z-g?_G9`*;~LNxYpecPdocE`V*Rh>^3e(w2KyWo}~u4PW20}IisJi7GV1L4K*b;sK& z50^8R^O5eYD1Bf!=Vimre(hs8dzD`9+}-)27jJ#5ZQR#8G2&tiIaE((<%<`kBiR~> zy8_(jOn5AAad4lA&eCYo__ba>n&?PGC)ZDiyN4^%meoaPpEL9a2YPQuA9;H+)ZvkX zmrbavqGsuEXCf=l|pZ0tg_000IagfB*srAb