Update EF & Readme
continuous-integration/drone/push Build is passing Details

master
Louwar 2 years ago
parent ce16d636fb
commit c85533aab5

@ -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*) - [ ] Réalisation du client MAUI et liaison avec l'api (*4 point*)
- [ ] Liaison avec la base de données (*2 point*) - [ ] Liaison avec la base de données (*2 point*)
- [ ] Filtrage + Pagination des données (*1 point*) - [ ] Filtrage + Pagination des données (*1 point*)
- [ ] Propreté du code (Vous pouvez vous servir de sonarqube) (*2 point*) - [X] Propreté du code (Vous pouvez vous servir de sonarqube) (*2 point*)
- [ ] Dockerisation et Hébergement des API (CodeFirst) (*3 point*) - [X] Dockerisation et Hébergement des API (CodeFirst) (*3 point*)
### Documentation (16 points) ### Documentation (16 points)
- [x] Le Readme (*4 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*) - [x] Merge request (*2 points*)
## Diagramme de classes du modèle ## Diagramme de classes du modèle

@ -64,7 +64,7 @@ namespace API.Controllers
return Ok(DtoChamps); return Ok(DtoChamps);
} }
/*[HttpGet] [HttpGet]
[Route("{Name}")] [Route("{Name}")]
public async Task<ActionResult<ChampionDto>> GetChampById(int id) public async Task<ActionResult<ChampionDto>> GetChampById(int id)
{ {
@ -86,7 +86,7 @@ namespace API.Controllers
IEnumerable<Champion?> Champs = await data.ChampionsMgr.GetItemsByName(name, await data.ChampionsMgr.GetNbItemsByName(name), 1); IEnumerable<Champion?> Champs = await data.ChampionsMgr.GetItemsByName(name, await data.ChampionsMgr.GetNbItemsByName(name), 1);
// Récupération du champion correspondant à l'id // 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 // Converstion en Champion au lieu de champion IEnumerable
Champion champion = Champs.First(); Champion champion = Champs.First();
@ -105,7 +105,7 @@ namespace API.Controllers
return BadRequest(); return BadRequest();
} }
/**** Méthodes POST **** /**** Méthodes POST ****/
[HttpPost("Ajouter/{nom}")] [HttpPost("Ajouter/{nom}")]
public async Task<ActionResult> PostChampName(string nom) public async Task<ActionResult> PostChampName(string nom)
{ {
@ -137,7 +137,7 @@ namespace API.Controllers
await data.ChampionsMgr.AddItem(championDto.ToModel())); await data.ChampionsMgr.AddItem(championDto.ToModel()));
} }
/**** Méthodes DELETE **** /**** Méthodes DELETE ****/
[HttpDelete("Supprimer/{id}")] [HttpDelete("Supprimer/{id}")]
public async Task<IActionResult> DeleteChamp(int id) public async Task<IActionResult> DeleteChamp(int id)
@ -154,8 +154,7 @@ namespace API.Controllers
} }
/**** Méthodes PUT ****/
/**** Méthodes PUT ****
[HttpPut("Modifier/{nom}")] [HttpPut("Modifier/{nom}")]
public async Task<ActionResult> PutChampName(string nom) public async Task<ActionResult> PutChampName(string nom)
@ -165,7 +164,7 @@ namespace API.Controllers
await data.ChampionsMgr.AddItem(champion); await data.ChampionsMgr.AddItem(champion);
return CreatedAtAction(nameof(GetChampById), new { id = data.ChampionsMgr.GetNbItems().Result - 1 }, champion.ToDto()); return CreatedAtAction(nameof(GetChampById), new { id = data.ChampionsMgr.GetNbItems().Result - 1 }, champion.ToDto());
}*/ }
/*[HttpPut("Modifier")] /*[HttpPut("Modifier")]
public async Task<IActionResult> PutChamp([FromBody] ChampionDto championDto) public async Task<IActionResult> PutChamp([FromBody] ChampionDto championDto)

@ -3,6 +3,7 @@ using Model;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EFlib namespace EFlib
{ {
@ -10,14 +11,21 @@ namespace EFlib
{ {
/**** Only Attributs ****/ /**** Only Attributs ****/
[Key] [Key]
[MaxLength(256)]
public string Name { get; set; } public string Name { get; set; }
[MaxLength(500)] [MaxLength(500)]
public string Bio { get; set; } public string Bio { get; set; }
public string Icon { get; set; } public string Icon { get; set; }
public ReadOnlyDictionary<string, int> Characteristics { get; private set; } public List<KeyValuePair<string, int>> CharacteristicsList { get; set; }
public ReadOnlyDictionary<string, int> Characteristics => new ReadOnlyDictionary<string, int>(CharacteristicsList.ToDictionary(kv => kv.Key, kv => kv.Value));
[Required]
public ChampionClass Class { get; set; } public ChampionClass Class { get; set; }
public ReadOnlyCollection<EFSkin> Skins { get; private set; } public ReadOnlyCollection<EFSkin> Skins { get; private set; }
public ImmutableHashSet<EFSkill> Skills { get; private set; } public ImmutableHashSet<EFSkill> Skills { get; private set; }
public LargeImage Image { get; set; } [ForeignKey("ImageId")]
public EFLargeImage Image { get; set; }
} }
} }

@ -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; }
}
}

@ -1,6 +1,7 @@
using Model; using Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using System.Text; using System.Text;
@ -10,9 +11,10 @@ namespace EFlib
{ {
public class EFRune public class EFRune
{ {
[Key]
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
public RuneFamily Family { get; set; } public RuneFamily Family { get; set; }
public LargeImage Image { get; set; } public EFLargeImage Image { get; set; }
} }
} }

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -10,8 +11,9 @@ namespace EFlib
{ {
public class EFRunePage public class EFRunePage
{ {
[Key]
public string Name { get; set; } public string Name { get; set; }
// public ReadOnlyDictionary<Category, EFRune> Runes { get; private set; } public List<KeyValuePair<Category, EFRune>> RunesList { get; set; }
public ReadOnlyDictionary<Category, EFRune> Runes => new ReadOnlyDictionary<Category, EFRune>(RunesList.ToDictionary(kv => kv.Key, kv => kv.Value));
} }
} }

@ -1,6 +1,7 @@
using Model; using Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -9,6 +10,7 @@ namespace EFlib
{ {
public class EFSkill public class EFSkill
{ {
[Key]
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
public SkillType Type { get; set; } public SkillType Type { get; set; }

@ -1,16 +1,18 @@
using Model; using Model;
using System.ComponentModel.DataAnnotations;
namespace EFlib namespace EFlib
{ {
public class EFSkin public class EFSkin
{ {
/**** Attributs ****/ /**** Attributs ****/
[Key]
public string Name { get; set; } public string Name { get; set; }
public EFChampion champion { get; set; } public EFChampion champion { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string Icon { get; set; } public string Icon { get; set; }
public float Price { get; set; } public float Price { get; set; }
public LargeImage Image { get; set; } public EFLargeImage Image { get; set; }
} }
} }

@ -17,6 +17,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

Loading…
Cancel
Save