diff --git a/README.md b/README.md index 50e9707..5555ca2 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,12 @@ Notre **API** va relier le tout afin de pouvoir de mettre un intermédiaire entr - [ ] Réalisation du client MAUI et liaison avec l'api (*4 point*) - [ ] Liaison avec la base de données (*2 point*) - [ ] Filtrage + Pagination des données (*1 point*) -- [ ] Propreté du code (Vous pouvez vous servir de sonarqube) (*2 point*) -- [ ] Dockerisation et Hébergement des API (CodeFirst) (*3 point*) +- [X] Propreté du code (Vous pouvez vous servir de sonarqube) (*2 point*) +- [X] Dockerisation et Hébergement des API (CodeFirst) (*3 point*) ### Documentation (16 points) - [x] Le Readme (*4 points*) -- [ ] Schéma et description de l'architecture globale de l'application (1 schéma + lien entre partie , min 1 page) (*8 points*) +- [X] Schéma et description de l'architecture globale de l'application (1 schéma + lien entre partie , min 1 page) (*8 points*) - [x] Merge request (*2 points*) ## Diagramme de classes du modèle diff --git a/Sources/API/Controllers/ChampionController.cs b/Sources/API/Controllers/ChampionController.cs index 2e23f7f..87816ba 100644 --- a/Sources/API/Controllers/ChampionController.cs +++ b/Sources/API/Controllers/ChampionController.cs @@ -64,7 +64,7 @@ namespace API.Controllers return Ok(DtoChamps); } - /*[HttpGet] + [HttpGet] [Route("{Name}")] public async Task> GetChampById(int id) { @@ -86,7 +86,7 @@ namespace API.Controllers IEnumerable Champs = await data.ChampionsMgr.GetItemsByName(name, await data.ChampionsMgr.GetNbItemsByName(name), 1); // Récupération du champion correspondant à l'id - if (id >= 0 && id < data.ChampionsMgr.GetNbItems().Result) + //if (await data.ChampionsMgr.GetNbItemsByName(name).Result) { // Converstion en Champion au lieu de champion IEnumerable Champion champion = Champs.First(); @@ -105,7 +105,7 @@ namespace API.Controllers return BadRequest(); } - /**** Méthodes POST **** + /**** Méthodes POST ****/ [HttpPost("Ajouter/{nom}")] public async Task PostChampName(string nom) { @@ -137,7 +137,7 @@ namespace API.Controllers await data.ChampionsMgr.AddItem(championDto.ToModel())); } - /**** Méthodes DELETE **** + /**** Méthodes DELETE ****/ [HttpDelete("Supprimer/{id}")] public async Task DeleteChamp(int id) @@ -154,8 +154,7 @@ namespace API.Controllers } - - /**** Méthodes PUT **** + /**** Méthodes PUT ****/ [HttpPut("Modifier/{nom}")] public async Task PutChampName(string nom) @@ -165,7 +164,7 @@ namespace API.Controllers await data.ChampionsMgr.AddItem(champion); return CreatedAtAction(nameof(GetChampById), new { id = data.ChampionsMgr.GetNbItems().Result - 1 }, champion.ToDto()); - }*/ + } /*[HttpPut("Modifier")] public async Task PutChamp([FromBody] ChampionDto championDto) diff --git a/Sources/EFlib/EFChampion.cs b/Sources/EFlib/EFChampion.cs index 12fa67c..ff2fcfb 100644 --- a/Sources/EFlib/EFChampion.cs +++ b/Sources/EFlib/EFChampion.cs @@ -3,6 +3,7 @@ using Model; using System.Collections.Immutable; using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace EFlib { @@ -10,14 +11,21 @@ namespace EFlib { /**** Only Attributs ****/ [Key] + [MaxLength(256)] public string Name { get; set; } [MaxLength(500)] public string Bio { get; set; } public string Icon { get; set; } - public ReadOnlyDictionary Characteristics { get; private set; } + public List> CharacteristicsList { get; set; } + public ReadOnlyDictionary Characteristics => new ReadOnlyDictionary(CharacteristicsList.ToDictionary(kv => kv.Key, kv => kv.Value)); + [Required] public ChampionClass Class { get; set; } public ReadOnlyCollection Skins { get; private set; } public ImmutableHashSet Skills { get; private set; } - public LargeImage Image { get; set; } + [ForeignKey("ImageId")] + public EFLargeImage Image { get; set; } + + + } } \ No newline at end of file diff --git a/Sources/EFlib/EFLargeImage.cs b/Sources/EFlib/EFLargeImage.cs new file mode 100644 index 0000000..b72ecd8 --- /dev/null +++ b/Sources/EFlib/EFLargeImage.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EFlib +{ + public class EFLargeImage + { + [Key] + public Guid Id { get; set; } + [Required] + public string Base64 { get; set; } + } +} diff --git a/Sources/EFlib/EFRune.cs b/Sources/EFlib/EFRune.cs index f360716..a158399 100644 --- a/Sources/EFlib/EFRune.cs +++ b/Sources/EFlib/EFRune.cs @@ -1,6 +1,7 @@ using Model; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Reflection.Metadata; using System.Text; @@ -10,9 +11,10 @@ namespace EFlib { public class EFRune { + [Key] public string Name { get; set; } public string Description { get; set; } public RuneFamily Family { get; set; } - public LargeImage Image { get; set; } + public EFLargeImage Image { get; set; } } } diff --git a/Sources/EFlib/EFRunePage.cs b/Sources/EFlib/EFRunePage.cs index 6bc6600..9276b3e 100644 --- a/Sources/EFlib/EFRunePage.cs +++ b/Sources/EFlib/EFRunePage.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,8 +11,9 @@ namespace EFlib { public class EFRunePage { + [Key] public string Name { get; set; } - // public ReadOnlyDictionary Runes { get; private set; } - + public List> RunesList { get; set; } + public ReadOnlyDictionary Runes => new ReadOnlyDictionary(RunesList.ToDictionary(kv => kv.Key, kv => kv.Value)); } } diff --git a/Sources/EFlib/EFSkill.cs b/Sources/EFlib/EFSkill.cs index 14ea1fc..b090479 100644 --- a/Sources/EFlib/EFSkill.cs +++ b/Sources/EFlib/EFSkill.cs @@ -1,6 +1,7 @@ using Model; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,6 +10,7 @@ namespace EFlib { public class EFSkill { + [Key] public string Name { get; set; } public string Description { get; set; } public SkillType Type { get; set; } diff --git a/Sources/EFlib/EFSkin.cs b/Sources/EFlib/EFSkin.cs index d42d767..77d7e30 100644 --- a/Sources/EFlib/EFSkin.cs +++ b/Sources/EFlib/EFSkin.cs @@ -1,16 +1,18 @@ using Model; +using System.ComponentModel.DataAnnotations; namespace EFlib { public class EFSkin { /**** Attributs ****/ + [Key] public string Name { get; set; } public EFChampion champion { get; set; } public string Description { get; set; } public string Icon { get; set; } public float Price { get; set; } - public LargeImage Image { get; set; } + public EFLargeImage Image { get; set; } } } diff --git a/Sources/EFlib/EFlib.csproj b/Sources/EFlib/EFlib.csproj index 0550ea3..0da59d4 100644 --- a/Sources/EFlib/EFlib.csproj +++ b/Sources/EFlib/EFlib.csproj @@ -16,7 +16,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + +