From 6c48f7ec08a873458a4b35d34307eab27379bdd3 Mon Sep 17 00:00:00 2001 From: Corentin R <76619184+Koroh63@users.noreply.github.com> Date: Sat, 25 Mar 2023 18:38:42 +0100 Subject: [PATCH 01/13] commit adding test --- Sources/.editorconfig | 4 ++++ Sources/EF_UT/EFDataManagerChampionTest.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Sources/.editorconfig diff --git a/Sources/.editorconfig b/Sources/.editorconfig new file mode 100644 index 0000000..73bb42e --- /dev/null +++ b/Sources/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# CS8604: Possible null reference argument. +dotnet_diagnostic.CS8604.severity = none diff --git a/Sources/EF_UT/EFDataManagerChampionTest.cs b/Sources/EF_UT/EFDataManagerChampionTest.cs index 07e3ca2..486a8be 100644 --- a/Sources/EF_UT/EFDataManagerChampionTest.cs +++ b/Sources/EF_UT/EFDataManagerChampionTest.cs @@ -47,7 +47,7 @@ namespace EF_UT var ak = (await championsManager.GetItemsByName("A", 0, 1)).First(); Assert.IsNotNull(ak); - //Assert.AreEqual("Akali", ak.Name); + Assert.AreEqual("Aatrox", ak.Name); } } } From f04c434c715b3544e01f5bf83c19bedc4d7ee919 Mon Sep 17 00:00:00 2001 From: Pierre Ferreira Date: Sun, 26 Mar 2023 00:19:20 +0100 Subject: [PATCH 02/13] =?UTF-8?q?:memo:=20D=C3=A9but=20de=20la=20formalisa?= =?UTF-8?q?tion=20du=20readme=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index 3228583..6ea67e3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,44 @@ + +# :alien: Consomation et Développement de services :construction_worker: + +#### :steam_locomotive: Comment lancer le projet ? + +> (Explication...) :construction: + + +#### :checkered_flag: Etat des livrables : + +:construction: +>:heavy_check_mark: Mise en place de toutes les opérations CRUD +>:heavy_check_mark: API RESTful (respect des règles de routage, utilisation des bons status code ...) +>:heavy_exclamation_mark: Utilisation des fichiers configurations +>:heavy_check_mark: Versionnage de l'api (avec versionnage de la doc) +>:construction: Logs +>:heavy_check_mark: Tests unitaires +> :heavy_exclamation_mark: Réalisation du client MAUI et liaison avec l'api +>:heavy_check_mark:Liaison avec la base de données +>:heavy_check_mark:Filtrage + Pagination des données +>:construction: Propreté du code (Vous pouvez vous servir de sonarqube) +>:heavy_check_mark: Dockerisation et Hébergement des API (CodeFirst) + +> :heavy_exclamation_mark: Sécurité +> :heavy_check_mark: Utilisation SonarQube + + +#### Diagramme d'architechture : + +=> Disponible à `./Diagramme d'architecture.jpg` + +--- +# :package: Entity FrameWork :construction_worker: +:construction: + +(trouver la grille de notation) + +--- +# Sujet principal : + +--- # prepaLoL ## Diagramme de classes du modèle From ae3c163e456479ab839949700b7d0f48551a5b09 Mon Sep 17 00:00:00 2001 From: Corentin R <76619184+Koroh63@users.noreply.github.com> Date: Sun, 26 Mar 2023 10:57:01 +0200 Subject: [PATCH 03/13] Ajout de log --- Sources/API_LoL/API_LoL.csproj | 3 ++- .../Controllers/ChampionsController.cs | 21 +++++++++++++++++-- Sources/API_LoL/Program.cs | 1 + Sources/Api_UT/ChampionControllerTest.cs | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Sources/API_LoL/API_LoL.csproj b/Sources/API_LoL/API_LoL.csproj index db2c1c8..91c61d0 100644 --- a/Sources/API_LoL/API_LoL.csproj +++ b/Sources/API_LoL/API_LoL.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -11,6 +11,7 @@ + diff --git a/Sources/API_LoL/Controllers/ChampionsController.cs b/Sources/API_LoL/Controllers/ChampionsController.cs index 96adf52..46dbcaf 100644 --- a/Sources/API_LoL/Controllers/ChampionsController.cs +++ b/Sources/API_LoL/Controllers/ChampionsController.cs @@ -8,6 +8,8 @@ using System.Drawing; using System; using API_LoL.Mapper; using System.Xml.Linq; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using System.Reflection.PortableExecutable; // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 @@ -21,12 +23,17 @@ namespace API_LoL.Controllers { public ChampionsController(IDataManager Manager) { + this._logger = LoggerFactory.Create(builder => builder.AddConsole()).CreateLogger(); this.ChampionsManager = Manager.ChampionsMgr; this.SkinsManager = Manager.SkinsMgr; } + private IChampionsManager ChampionsManager; private ISkinsManager SkinsManager; + //private StubData stubData; + private ILogger logger; + private readonly ILogger _logger; // GET api//5 @@ -41,6 +48,7 @@ namespace API_LoL.Controllers { if (size - index > 10) { + _logger.LogError(message : "Oversized","Get","/Champion",400,"name : "+name,"skill : "+skill,"characteristics : "+characteristic,"index : "+index,"size : "+size,DateTime.Now); return BadRequest(); } if (!string.IsNullOrEmpty(name)) @@ -81,7 +89,11 @@ namespace API_LoL.Controllers [HttpGet("name")] public async Task GetByName(String name) { - if (string.IsNullOrEmpty(name)) return BadRequest(); + if (string.IsNullOrEmpty(name)) + { + _logger.LogError(message: "No paramater given", "Get", "/Champion/Name", 400, "name : " + name, DateTime.Now); + return BadRequest(); + } var list = await ChampionsManager.GetItemsByName(name, 0, 1); if (list.Count() == 1) { @@ -94,7 +106,11 @@ namespace API_LoL.Controllers [HttpGet("name/skins")] public async Task GetSkinsByName(String name) { - if (string.IsNullOrEmpty(name)) return BadRequest(); + if (string.IsNullOrEmpty(name)) + { + _logger.LogError(message: "No paramater given", "Get", "/Champion/Name/Skins", 400, "name : " + name, DateTime.Now); + return BadRequest(); + } var list = await ChampionsManager.GetItemsByName(name, 0, 1); if (list.Count() == 1) { @@ -134,6 +150,7 @@ namespace API_LoL.Controllers { if (champion == null) { + _logger.LogError(message: "Null paramater given", "Post", "/Champion", 422, "champion : " + champion.toString, DateTime.Now); return UnprocessableEntity(); } else diff --git a/Sources/API_LoL/Program.cs b/Sources/API_LoL/Program.cs index f1b44d0..78d467f 100644 --- a/Sources/API_LoL/Program.cs +++ b/Sources/API_LoL/Program.cs @@ -3,6 +3,7 @@ using EntityFramework; using EntityFramework.Manager; using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Versioning; +using Microsoft.Extensions.Logging; using Model; using StubLib; diff --git a/Sources/Api_UT/ChampionControllerTest.cs b/Sources/Api_UT/ChampionControllerTest.cs index 09c7875..0a93acf 100644 --- a/Sources/Api_UT/ChampionControllerTest.cs +++ b/Sources/Api_UT/ChampionControllerTest.cs @@ -3,6 +3,7 @@ using DTO; using FluentAssertions; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Logging; using Model; using StubLib; using System.Collections; From bc5186fa9d5cfe3f10a783928b701b89ef6c414e Mon Sep 17 00:00:00 2001 From: Corentin R <76619184+Koroh63@users.noreply.github.com> Date: Sun, 26 Mar 2023 11:36:14 +0200 Subject: [PATCH 04/13] ajout logErrors --- Sources/API_LoL/Controllers/ChampionsController.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sources/API_LoL/Controllers/ChampionsController.cs b/Sources/API_LoL/Controllers/ChampionsController.cs index 46dbcaf..afd09fa 100644 --- a/Sources/API_LoL/Controllers/ChampionsController.cs +++ b/Sources/API_LoL/Controllers/ChampionsController.cs @@ -158,6 +158,7 @@ namespace API_LoL.Controllers var champ = await ChampionsManager.GetItemsByName(champion.Name, 0, 1); if(champ.Count() != 0 && champ.FirstOrDefault().Name == champion.Name) { + _logger.LogError(message: "Champion with this id already exists", "Post", "/Champion", 409, "champion : " + champion.toString, DateTime.Now); return Conflict(champion); } await ChampionsManager.AddItem(champion.ToChampion()); @@ -170,10 +171,16 @@ namespace API_LoL.Controllers [HttpPut("name")] public async Task Put(string name, ChampionDTO championDTO) { - if(string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) + { + _logger.LogError(message: "Null paramater given for Name", "Put", "/Champion/Name", 400,"name : "+name, "champion : " + championDTO.toString, DateTime.Now); return BadRequest(); + } if(championDTO == null) + { + _logger.LogError(message: "Null paramater given for Champion", "Put", "/Champion/Name", 422, "name : " + name, "champion : " + championDTO.toString, DateTime.Now); return UnprocessableEntity(); + } var list = await ChampionsManager.GetItemsByName(name, 0, 1); if (list.Count() == 1) { @@ -187,7 +194,10 @@ namespace API_LoL.Controllers public async Task Delete(string name) { if (string.IsNullOrEmpty(name)) - return BadRequest(); + { + _logger.LogError(message: "Null paramater given for Name", "Delete", "/Champion/Name", 400, "name : " + name, DateTime.Now); + return BadRequest(); + } var list = await ChampionsManager.GetItemsByName(name, 0, 1); if(list.Count() == 1){ return Ok(await ChampionsManager.DeleteItem(list.First())); From feaa59f594259739c6960d9c9e0e131f9a9d5e69 Mon Sep 17 00:00:00 2001 From: Pierre FERREIRA Date: Sun, 26 Mar 2023 12:23:46 +0200 Subject: [PATCH 05/13] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6ea67e3..63197a6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # :alien: Consomation et Développement de services :construction_worker: +![C#](https://img.shields.io/badge/c%23-%23239120.svg?style=for-the-badge&logo=c-sharp&logoColor=white) +![JWT](https://img.shields.io/badge/JWT-black?style=for-the-badge&logo=JSON%20web%20tokens) +![Markdown](https://img.shields.io/badge/markdown-%23000000.svg?style=for-the-badge&logo=markdown&logoColor=white) #### :steam_locomotive: Comment lancer le projet ? > (Explication...) :construction: From 11e66747835e208485d08a19e9721d51f5ba7b9e Mon Sep 17 00:00:00 2001 From: Pierre FERREIRA Date: Sun, 26 Mar 2023 13:53:56 +0200 Subject: [PATCH 06/13] =?UTF-8?q?:memo:=20r=C3=A9daction=20du=20bar=C3=A8m?= =?UTF-8?q?e=20de=20l'Entity=20Framework?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63197a6..38c90b5 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,40 @@ # :package: Entity FrameWork :construction_worker: :construction: -(trouver la grille de notation) + +Partie 1 : +* Exo1 : + une base de données + une table de champion + utilisation du client console/mobile + requetes CRUD (+ tri, filtrage) + +* Exo2 : + UT + Base de données stubbée + SQLiteInMemory + +* Exo3 : + Déploiement EF et tests via code#0 + +--- + +Partie 2 : +* Exo4 : + implémentation des runes et skins (1 table -> pas de relation) + +* Exo5 : + Relation entre champion et skin (OneToMany) + +* Exo6 : + Relation entre Champion RunePage et Rune (ManyToMany) + +* Exo7 : + mapping entre model et entité (intégration de qualité) + (en 1 table et avec relations) + +* Exo8 : + Ajouter le paterne UnitOfWork (rollback en cas de probleme sur les transaction) --- # Sujet principal : From 5d7002c8e8228b9dd40af82d12711d2bbce125ca Mon Sep 17 00:00:00 2001 From: Corentin R <76619184+Koroh63@users.noreply.github.com> Date: Sun, 26 Mar 2023 14:59:33 +0200 Subject: [PATCH 07/13] add all logs --- .../Controllers/ChampionsController.cs | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/Sources/API_LoL/Controllers/ChampionsController.cs b/Sources/API_LoL/Controllers/ChampionsController.cs index afd09fa..2c35997 100644 --- a/Sources/API_LoL/Controllers/ChampionsController.cs +++ b/Sources/API_LoL/Controllers/ChampionsController.cs @@ -40,6 +40,7 @@ namespace API_LoL.Controllers [HttpGet("count")] public async Task GetCount() { + _logger.LogInformation(message: "count returned", "Get", "/Champion/Count", 200, DateTime.Now); return Ok(ChampionsManager.GetNbItems()); } @@ -56,33 +57,46 @@ namespace API_LoL.Controllers var list = await ChampionsManager.GetItemsByName(name, index, size); if (list.Count() != 0) { + _logger.LogInformation(message: "Champion returned by name", "Get", "/Champion", 200, "name : " + name, "skill : " + skill, "characteristic : " + characteristic, "index : " + index, "size : " + size, DateTime.Now); return Ok(list.Select(champion => champion?.ToDTO())); } - else { return NoContent(); } + else { + _logger.LogInformation(message: "No Champion found by name", "Get", "/Champion", 204, "name : " + name, "skill : " + skill, "characteristic : " + characteristic, "index : " + index, "size : " + size, DateTime.Now); + return NoContent(); } } else if(!string.IsNullOrEmpty(skill)) { var list = await ChampionsManager.GetItemsBySkill(skill, index, size); if (list.Count() != 0) { + _logger.LogInformation(message: "Champion returned by skill", "Get", "/Champion", 200, "name : " + name, "skill : " + skill, "characteristic : " + characteristic, "index : " + index, "size : " + size, DateTime.Now); return Ok(list.Select(champion => champion?.ToDTO())); } - else { return NoContent(); } + else { + _logger.LogInformation(message: "No Champion found by skill", "Get", "/Champion", 204, "name : " + name, "skill : " + skill, "characteristic : " + characteristic, "index : " + index, "size : " + size, DateTime.Now); + return NoContent(); } } else if(!string.IsNullOrEmpty (characteristic)) { var list = await ChampionsManager.GetItems(index, size); if (list.Count() != 0) { + _logger.LogInformation(message: "Champion returned by characteristic", "Get", "/Champion", 200, "name : " + name, "skill : " + skill, "characteristic : " + characteristic, "index : " + index, "size : " + size, DateTime.Now); return Ok(list.Select(champion => champion?.ToDTO())); } - else { return NoContent(); } + else { + _logger.LogInformation(message: "No Champion found by char", "Get", "/Champion", 204, "name : " + name, "skill : " + skill, "characteristic : " + characteristic, "index : " + index, "size : " + size, DateTime.Now); + return NoContent(); } } else { var list = await ChampionsManager.GetItems(index, size); if (list.Count() != 0) { + _logger.LogInformation(message: "Champion returned default", "Get", "/Champion", 200, "name : " + name, "skill : " + skill, "characteristic : " + characteristic, "index : " + index, "size : " + size, DateTime.Now); return Ok(list.Select(champion => champion?.ToDTO())); } - else { return NoContent(); } + else { + _logger.LogInformation(message: "No Champion found Default", "Get", "/Champion", 204, "name : " + name,"skill : " + skill,"characteristic : "+ characteristic,"index : "+index,"size : "+size, DateTime.Now); + return NoContent(); + } } } @@ -97,9 +111,13 @@ namespace API_LoL.Controllers var list = await ChampionsManager.GetItemsByName(name, 0, 1); if (list.Count() == 1) { + _logger.LogInformation(message: "Champion found", "Get", "/Champion/Name", 20, "name : " + name, DateTime.Now); return Ok(list.Select(champion => champion?.ToDTO()).First()); } - else { return NoContent(); } + else { + _logger.LogInformation(message: "No Champion found", "Get", "/Champion/Name", 204, "name : " + name, DateTime.Now); + return NoContent(); + } } @@ -120,9 +138,16 @@ namespace API_LoL.Controllers var skins = await SkinsManager.GetItemsByChampion(list.First(), 0, nb); return Ok(skins.Select(skin => skin?.ToDTO())); } - else { return NoContent(); } + else { + _logger.LogInformation(message: "No Skin found found", "Get", "/Champion/Name/Skins", 204, "name : " + name, DateTime.Now); + return NoContent(); } + } + else { + _logger.LogInformation(message: "No Champion found", "Get", "/Champion/Name/Skins", 204, "name : " + name, DateTime.Now); + + return NoContent(); } - else { return NoContent(); } + } //[HttpGet("name/skills")] @@ -155,13 +180,18 @@ namespace API_LoL.Controllers } else { - var champ = await ChampionsManager.GetItemsByName(champion.Name, 0, 1); - if(champ.Count() != 0 && champ.FirstOrDefault().Name == champion.Name) + var list = await ChampionsManager.GetItemsByName(champion.Name, 0, 1); + Champion champ = list.FirstOrDefault(); + if (champ != null) { - _logger.LogError(message: "Champion with this id already exists", "Post", "/Champion", 409, "champion : " + champion.toString, DateTime.Now); - return Conflict(champion); + if(champ.Name == champion.Name) + { + _logger.LogError(message: "Champion with this id already exists", "Post", "/Champion", 409, "champion : " + champion.toString, DateTime.Now); + return Conflict(champion); + } } await ChampionsManager.AddItem(champion.ToChampion()); + _logger.LogInformation(message: "Champion created", "Post", "Champion/Name", 201, "champion : " + champion.toString, DateTime.Now); return CreatedAtAction("Post",champion); } @@ -184,9 +214,13 @@ namespace API_LoL.Controllers var list = await ChampionsManager.GetItemsByName(name, 0, 1); if (list.Count() == 1) { + _logger.LogInformation(message: "Champion updated", "Put", "Champion/Name", 200, "name : " + name, "champion : " + championDTO.toString, DateTime.Now); return Ok(ChampionsManager.UpdateItem(list.First(), championDTO.ToChampion())); } - else { return NoContent(); } + else { + _logger.LogInformation(message: "No champion Found", "Put", "/Champion/Name", 204, "name : " + name, "champion : " + championDTO.toString, DateTime.Now); + return NoContent(); + } } // DELETE api//5 @@ -200,8 +234,11 @@ namespace API_LoL.Controllers } var list = await ChampionsManager.GetItemsByName(name, 0, 1); if(list.Count() == 1){ + _logger.LogInformation(message: "Champion Deleted", "Delete", "/Champion/Name", 200, "name : " + name, DateTime.Now); return Ok(await ChampionsManager.DeleteItem(list.First())); - }else { return NoContent(); } + }else { + _logger.LogInformation(message: "No champion Found", "Delete", "/Champion/Name", 204, "name : " + name, DateTime.Now); + return NoContent(); } } } } From c2a4916dc75ca6b478e2f3a1725c7a46200b6df0 Mon Sep 17 00:00:00 2001 From: Pierre FERREIRA Date: Sun, 26 Mar 2023 15:00:39 +0200 Subject: [PATCH 08/13] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 38c90b5..cf7501a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ -# :alien: Consomation et Développement de services :construction_worker: +# Projet d'Entity FrameWork et Consomation et Développement de services + +Notre projet à pour objectif la liaison entre une base de donnée et un client, par l'utilisation d' ``EntityFramework`` et d'une ``API`` C# créé par nous même. ![C#](https://img.shields.io/badge/c%23-%23239120.svg?style=for-the-badge&logo=c-sharp&logoColor=white) ![JWT](https://img.shields.io/badge/JWT-black?style=for-the-badge&logo=JSON%20web%20tokens) ![Markdown](https://img.shields.io/badge/markdown-%23000000.svg?style=for-the-badge&logo=markdown&logoColor=white) + +> *A noter que seul la v1 est prise en compte, la v2 et v2.2 ne sont presentes uniquement pour prouver notre capacité à versionner* + +Ce projet est decoupé en deux parties : + +## :alien: Consomation et Développement de services :construction_worker: + + #### :steam_locomotive: Comment lancer le projet ? > (Explication...) :construction: @@ -12,20 +22,22 @@ #### :checkered_flag: Etat des livrables : :construction: ->:heavy_check_mark: Mise en place de toutes les opérations CRUD ->:heavy_check_mark: API RESTful (respect des règles de routage, utilisation des bons status code ...) ->:heavy_exclamation_mark: Utilisation des fichiers configurations ->:heavy_check_mark: Versionnage de l'api (avec versionnage de la doc) ->:construction: Logs ->:heavy_check_mark: Tests unitaires -> :heavy_exclamation_mark: Réalisation du client MAUI et liaison avec l'api ->:heavy_check_mark:Liaison avec la base de données ->:heavy_check_mark:Filtrage + Pagination des données ->:construction: Propreté du code (Vous pouvez vous servir de sonarqube) ->:heavy_check_mark: Dockerisation et Hébergement des API (CodeFirst) - -> :heavy_exclamation_mark: Sécurité -> :heavy_check_mark: Utilisation SonarQube +> * :heavy_check_mark: Mise en place de toutes les opérations CRUD +> * :heavy_check_mark: API RESTful (respect des règles de routage, utilisation des bons status code ...) +> * :heavy_exclamation_mark: Utilisation des fichiers configurations +> * :heavy_check_mark: Versionnage de l'api (avec versionnage de la doc) +> * :heavy_exclamation_mark: Logs +> * :heavy_check_mark: Tests unitaires +> * :heavy_exclamation_mark: Réalisation du client MAUI et liaison avec l'api +> * :heavy_check_mark:Liaison avec la base de données +> * :heavy_check_mark:Filtrage + Pagination des données +> * :construction: Propreté du code (Vous pouvez vous servir de sonarqube) +> * :heavy_check_mark: Dockerisation et Hébergement des API (CodeFirst) + +> * :heavy_exclamation_mark: Sécurité +> * :heavy_check_mark: Utilisation SonarQube + +[![Build Status](https://codefirst.iut.uca.fr/api/badges/corentin.richard/EntityFramework_ConsoDeServices_TP/status.svg)](https://codefirst.iut.uca.fr/corentin.richard/EntityFramework_ConsoDeServices_TP) #### Diagramme d'architechture : @@ -33,7 +45,7 @@ => Disponible à `./Diagramme d'architecture.jpg` --- -# :package: Entity FrameWork :construction_worker: +## :package: Entity FrameWork :construction_worker: :construction: From 9d2d8c3805e1f8155a1e4b40bcb5f985a50160e2 Mon Sep 17 00:00:00 2001 From: Pierre FERREIRA Date: Sun, 26 Mar 2023 15:01:07 +0200 Subject: [PATCH 09/13] logs :heavy_check_mark: --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf7501a..9babb9b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Ce projet est decoupé en deux parties : > * :heavy_check_mark: API RESTful (respect des règles de routage, utilisation des bons status code ...) > * :heavy_exclamation_mark: Utilisation des fichiers configurations > * :heavy_check_mark: Versionnage de l'api (avec versionnage de la doc) -> * :heavy_exclamation_mark: Logs +> * :heavy_check_mark: Logs > * :heavy_check_mark: Tests unitaires > * :heavy_exclamation_mark: Réalisation du client MAUI et liaison avec l'api > * :heavy_check_mark:Liaison avec la base de données From 03507e9c8aa08ba386c2823a8b7bb353b6c04334 Mon Sep 17 00:00:00 2001 From: Pierre FERREIRA Date: Sun, 26 Mar 2023 15:05:24 +0200 Subject: [PATCH 10/13] =?UTF-8?q?Maj=20=C3=A9tat=20des=20livrables=20EF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9babb9b..56a009c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Ce projet est decoupé en deux parties : > (Explication...) :construction: -#### :checkered_flag: Etat des livrables : +#### :checkered_flag: État des livrables : :construction: > * :heavy_check_mark: Mise en place de toutes les opérations CRUD @@ -48,39 +48,41 @@ Ce projet est decoupé en deux parties : ## :package: Entity FrameWork :construction_worker: :construction: +#### :checkered_flag: État des livrables : Partie 1 : -* Exo1 : +* Exo1 : :construction: une base de données une table de champion utilisation du client console/mobile requetes CRUD (+ tri, filtrage) -* Exo2 : +* Exo2 : :heavy_check_mark: UT Base de données stubbée SQLiteInMemory -* Exo3 : +* Exo3 : :heavy_check_mark: Déploiement EF et tests via code#0 --- Partie 2 : -* Exo4 : +* Exo4 : :heavy_check_mark: implémentation des runes et skins (1 table -> pas de relation) -* Exo5 : +* Exo5 : :heavy_check_mark: Relation entre champion et skin (OneToMany) -* Exo6 : - Relation entre Champion RunePage et Rune (ManyToMany) +* Exo6 : :heavy_check_mark: + Relation entre Champion, RunePage et Rune (ManyToMany) +> La relation entre Rune et RunePage à été simplifiée par manque de temps, il ne s'agit donc pas d'un dictionaire mais d'un OneToMany. -* Exo7 : +* Exo7 : :heavy_check_mark: mapping entre model et entité (intégration de qualité) (en 1 table et avec relations) -* Exo8 : +* Exo8 : :heavy_exclamation_mark: Ajouter le paterne UnitOfWork (rollback en cas de probleme sur les transaction) --- From 848075afc1f4897c53f82b4e411c9a1f04b4f431 Mon Sep 17 00:00:00 2001 From: Corentin R <76619184+Koroh63@users.noreply.github.com> Date: Sun, 26 Mar 2023 15:07:39 +0200 Subject: [PATCH 11/13] db changes --- Sources/API_LoL/champion.db-shm | Bin 0 -> 32768 bytes Sources/API_LoL/champion.db-wal | Bin 0 -> 16512 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Sources/API_LoL/champion.db-shm create mode 100644 Sources/API_LoL/champion.db-wal diff --git a/Sources/API_LoL/champion.db-shm b/Sources/API_LoL/champion.db-shm new file mode 100644 index 0000000000000000000000000000000000000000..39d4916c878b6cc02f09651befbe37e6e088f260 GIT binary patch literal 32768 zcmeI)u?@m75CA|Y(1B3OEJ05;pkxH5pd^9?JO?EmQ?LROEWid}M-b5=IuzYYueWUL zt-k?WU*{o5nX(9>8mBr*d06bHVRKroV-wHuwrjSt_OiSm>mTo@R$b)2kB@k5_a(nS zO8Kt+fdv5q1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1O_NjbU&^Pa4;hg_$p9_{3nqhK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ K009F3DDVWtnI(Y$ literal 0 HcmV?d00001 diff --git a/Sources/API_LoL/champion.db-wal b/Sources/API_LoL/champion.db-wal new file mode 100644 index 0000000000000000000000000000000000000000..932d20caf04e247bef2ba22ec0730725e621b6c9 GIT binary patch literal 16512 zcmeI&J&0UY6ae72JDC}0XP0La)*;PlWDv45E@X9MBP(eQ5e3V5=e;wtcXQvpZ|~1! zwvt3_v{7VIu>ErZ=^j=z}M=vUCo`(fkfCX591z3OuSbzmsfCX59 z1z6x20^P+7}?s(CRkMEIrvDXs$GRON-rsQ=P^-UDDn_Besk?1IwL8ud{Q! zFYr{oz-x!!e{%5Z(RZ<4puPI&sd@pr<%0!SfCX591z3OuSbzmsfCc`C0-wIuZm)l~ zc5OY`(OTjKp(kiDI6MndXVx5uk-`GChtgK_%w+VUZVBi-1dV`tEa-J1CJ4Fl)tpX! zoOvsZ&7~I7qJz?esgc$}j!+(0b4BWE?j#Q2-Rfq6P<;ieZ;Fwn&eXgx+KY*%t2}_F zabmxVW)|F8a3annY2rEn$b_Rf;*Dj7&T1ipVsbqCD6#f+Jcpc!ZRK`i89aQtec)HSYSO>C*DpTnsDN$@ios5&P zn6;!~Jy=o7d|^mwW|W$(zENl)qY=nd3GW7QN!UVCa1Qn`%wR00#!4D;F;a|9>ZzeD zEjY?@BvEe&Sx}lLP@JftL>01KTAvT(Xhg9Sl?e`%fU&XEKko->WR1tnW3Vw>B?=mW zCP$kGY9S~^)t6e+I%|R`(U#TRhdKya0@Z&)bo>!G5xk7Ti>?$s%~jp>4$R19q)$=A zwH08IVzcy%OG#;{{Sf1+S7tv**fW&cVAuQ7y)_&vqc$9UB!jCsQf4xkW1dk7dVzL&`((YqZ7Lt& mg9TWC1z3OuSbzmsfCX591z3OuSm3`PP*(xOjjn%JFYpfx#-R)V literal 0 HcmV?d00001 From 31bfa2b0560b6167bf69ef134360e3c4b2859bfb Mon Sep 17 00:00:00 2001 From: Pierre FERREIRA Date: Sun, 26 Mar 2023 15:18:54 +0200 Subject: [PATCH 12/13] =?UTF-8?q?Ajout=20Coordonn=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 56a009c..b0ba7c5 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,20 @@ Partie 2 : * Exo8 : :heavy_exclamation_mark: Ajouter le paterne UnitOfWork (rollback en cas de probleme sur les transaction) +--- +## Explication de ce qu'on a fait et ce qu'on a pas fait et pourquoi on a priorisé ca plutot que d'autre : + +:construction: + + + +## Coordonnées : + +``Corentin Richard`` : **[corentin.richard@etu.uca.fr](https://codefirst.iut.uca.fr/git/corentin.richard)** + +``Pierre Ferreira`` : **[pierre.ferreira@etu.uca.fr](https://codefirst.iut.uca.fr/git/pierre.ferreira)** + + --- # Sujet principal : From 0720e06c14e20cf5e16f0a83746670417f673787 Mon Sep 17 00:00:00 2001 From: Corentin R <76619184+Koroh63@users.noreply.github.com> Date: Sun, 26 Mar 2023 16:43:45 +0200 Subject: [PATCH 13/13] Creation du client console --- .../ConsoleApplication.csproj | 15 +++++ Sources/ConsoleApplication/Program.cs | 44 +++++++++++++++ Sources/ConsoleApplication/Utils.cs | 55 +++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 Sources/ConsoleApplication/ConsoleApplication.csproj create mode 100644 Sources/ConsoleApplication/Program.cs create mode 100644 Sources/ConsoleApplication/Utils.cs diff --git a/Sources/ConsoleApplication/ConsoleApplication.csproj b/Sources/ConsoleApplication/ConsoleApplication.csproj new file mode 100644 index 0000000..3e93ad0 --- /dev/null +++ b/Sources/ConsoleApplication/ConsoleApplication.csproj @@ -0,0 +1,15 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + diff --git a/Sources/ConsoleApplication/Program.cs b/Sources/ConsoleApplication/Program.cs new file mode 100644 index 0000000..d3916f1 --- /dev/null +++ b/Sources/ConsoleApplication/Program.cs @@ -0,0 +1,44 @@ + +using ConsoleApplication; +using EntityFramework; +using HttpClient; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Model; + +var builder = WebApplication.CreateBuilder(); + +builder.Services.AddDbContext(); + +var app = builder.Build(); + +using (var scope = app.Services.CreateScope()) +{ + var context = scope.ServiceProvider.GetService(); + context.Database.EnsureCreated(); +} + +IDataManager dataManager = new HttpClientManager(); + +string choice = "0"; + +while (choice != "9") +{ + Utils.showMainMenu(); + choice = Console.ReadLine(); + + switch (choice) + { + case "1": + { + Utils.championMenu(dataManager.ChampionsMgr); + break; + } + case "2": + { + //Utils. + break; + } + + } +} \ No newline at end of file diff --git a/Sources/ConsoleApplication/Utils.cs b/Sources/ConsoleApplication/Utils.cs new file mode 100644 index 0000000..fb70443 --- /dev/null +++ b/Sources/ConsoleApplication/Utils.cs @@ -0,0 +1,55 @@ +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApplication +{ + public static class Utils + { + public static void showMainMenu() + { + Console.WriteLine("-------- Menu -------"); + Console.WriteLine(" 1 - Champions "); + Console.WriteLine(" 2 - Skills "); + Console.WriteLine("\n 9 - Quitter"); + } + + public static void showChampionMenu() + { + Console.WriteLine("-------- Champion -------"); + Console.WriteLine(" 1 - Count "); + Console.WriteLine(" 2 - Default "); + Console.WriteLine("\n 9 - Quitter"); + } + + public static async void championMenu(IChampionsManager championsManager ) { + string choix = "0"; + + while (choix != "9") + { + Utils.showChampionMenu(); + choix = Console.ReadLine(); + + switch (choix) + { + case "1": + //Console.WriteLine("# result : "+ await championsManager.GetNbItems()); + break; + case "2": + var list = await championsManager.GetItems(0, 10); + foreach(var cham in list) + { + Console.WriteLine("# result : " +cham.ToString()); + + } + break; + } + } + } + + + } +}