From b2dc449adb9deb8e41920e2989da72814f2d7a20 Mon Sep 17 00:00:00 2001 From: "josephine.vetu" Date: Tue, 31 Mar 2026 13:53:42 +0200 Subject: [PATCH] add TODO --- Webzine.Repository.Contracts/IArtisteRepository.cs | 2 +- Webzine.Repository/DbArtisteRepository.cs | 2 +- Webzine.Repository/DbStyleRepository.cs | 4 ++-- Webzine.Repository/DbTitreRepository.cs | 4 ++-- Webzine.Repository/LocalArtisteRepository.cs | 10 +++++----- Webzine.Repository/LocalCommentaireRepository.cs | 2 +- Webzine.Repository/LocalTitreRepository.cs | 8 +++++--- .../Controllers/DashboardController.cs | 2 +- .../Controllers/RechercheController.cs | 13 +++++++++++-- .../Controllers/TitreController.cs | 2 +- Webzine.WebApplication/Program.cs | 2 -- 11 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Webzine.Repository.Contracts/IArtisteRepository.cs b/Webzine.Repository.Contracts/IArtisteRepository.cs index bc13f76..3c873c9 100644 --- a/Webzine.Repository.Contracts/IArtisteRepository.cs +++ b/Webzine.Repository.Contracts/IArtisteRepository.cs @@ -4,7 +4,7 @@ namespace Webzine.Repository.Contracts /// /// Défini une interface pour gérer les opérations de base de données liées aux artistes. - /// + /// // TODO interface n'est pas que liée à la bdd, elle est aussi utilisée pour la gestion en mémoire public interface IArtisteRepository { /// diff --git a/Webzine.Repository/DbArtisteRepository.cs b/Webzine.Repository/DbArtisteRepository.cs index c27c1d7..d34628e 100644 --- a/Webzine.Repository/DbArtisteRepository.cs +++ b/Webzine.Repository/DbArtisteRepository.cs @@ -13,7 +13,7 @@ namespace Webzine.Repository /// /// Initialise une classe qui implémente l'interface pour gérer les opérations de base de données liées aux artistes. - /// Utilise en injection de dépendances. + /// Utilise en injection de dépendances. // TODO commentaire faux. /// public class DbArtisteRepository : IArtisteRepository { diff --git a/Webzine.Repository/DbStyleRepository.cs b/Webzine.Repository/DbStyleRepository.cs index c350a4f..4f5c20c 100644 --- a/Webzine.Repository/DbStyleRepository.cs +++ b/Webzine.Repository/DbStyleRepository.cs @@ -93,10 +93,10 @@ public class DbStyleRepository : IStyleRepository { this.logger.LogDebug("Recherche du style avec l'ID: {Id}", id); - if (id <= 0) + if (id <= 0) // TODO à supprimer, c'est au controller de vérifier la validité de l'id { this.logger.LogWarning("Tentative de recherche d'un style avec un Id invalide: {Id}", id); - return new Style(); + return new Style(); // TODO pas de retour d'objet vide } this.logger.LogDebug("Préparation de la requête avec inclusion des titres"); diff --git a/Webzine.Repository/DbTitreRepository.cs b/Webzine.Repository/DbTitreRepository.cs index ab362b9..9390c15 100644 --- a/Webzine.Repository/DbTitreRepository.cs +++ b/Webzine.Repository/DbTitreRepository.cs @@ -33,7 +33,7 @@ public class DbTitreRepository : ITitreRepository try { this.logger.LogInformation("Ajout d'un nouveau titre: {Libelle}", titre.Libelle); - this.logger.LogDebug("Début de l'ajout du titre en base de données"); + this.logger.LogDebug("Début de l'ajout du titre en base de données"); // TODO trop de logs this.context.Titres.Add(titre); this.context.SaveChanges(); @@ -288,7 +288,7 @@ public class DbTitreRepository : ITitreRepository { try { - this.logger.LogDebug("Récupération de tous les titres"); + this.logger.LogDebug("Récupération de tous les titres"); // TODO trop de logs this.logger.LogDebug("Préparation de la requête avec les inclusions Artiste et Styles"); var titres = this.context.Titres diff --git a/Webzine.Repository/LocalArtisteRepository.cs b/Webzine.Repository/LocalArtisteRepository.cs index 69021c5..a65fe44 100644 --- a/Webzine.Repository/LocalArtisteRepository.cs +++ b/Webzine.Repository/LocalArtisteRepository.cs @@ -11,20 +11,20 @@ namespace Webzine.Repository /// /// Initialise une classe qui implémente l'interface pour gérer les opérations de base de données liées aux artistes. - /// Utilise en injection de dépendances. + /// Utilise en injection de dépendances. // TODO faux. /// public class LocalArtisteRepository : IArtisteRepository { private readonly ILogger logger; - // private readonly List artistes; + // private readonly List artistes; // TODO code mort private readonly InMemoryDataStore dataStore; /// /// Initializes a new instance of the class. /// Est liéee à une liste d'artistes en local et utilise un logger pour enregistrer les opérations effectuées sur les artistes. /// - /// La liste des artistes à initialiser. Ne peut pas être null. + /// La liste des artistes à initialiser. Ne peut pas être null. // TODO pas le bon paramètre /// Le logger à utiliser pour enregistrer les messages de journalisation. Ne peut pas être null. public LocalArtisteRepository(InMemoryDataStore dataStore, ILogger logger) { @@ -37,7 +37,7 @@ namespace Webzine.Repository /// public void Add(Artiste artiste) { - throw new NotSupportedException("Mode Local"); + throw new NotSupportedException("Mode Local"); // TODO à implémenter } /// @@ -52,7 +52,7 @@ namespace Webzine.Repository var artiste = this.dataStore.Artistes.First(a => a.IdArtiste == id); if (artiste == null) { - return new Artiste(); + return new Artiste(); // TODO ne pas retourner un objet vide, FirstOrDefault et gérer le null dans le controller } return artiste; diff --git a/Webzine.Repository/LocalCommentaireRepository.cs b/Webzine.Repository/LocalCommentaireRepository.cs index 8a91ab8..a0b1da3 100644 --- a/Webzine.Repository/LocalCommentaireRepository.cs +++ b/Webzine.Repository/LocalCommentaireRepository.cs @@ -38,7 +38,7 @@ namespace Webzine.Repository /// public void Add(Commentaire commentaire) { - throw new NotSupportedException("Mode Local"); + throw new NotSupportedException("Mode Local"); // TODO à implémenter } /// diff --git a/Webzine.Repository/LocalTitreRepository.cs b/Webzine.Repository/LocalTitreRepository.cs index ff8832c..bc1e488 100644 --- a/Webzine.Repository/LocalTitreRepository.cs +++ b/Webzine.Repository/LocalTitreRepository.cs @@ -34,7 +34,9 @@ public class LocalTitreRepository : ITitreRepository /// public int Count() { - var count = this.dataStore.Titres.Count(); + var count = this.dataStore.Titres.Count(); // TODO une seule ligne, et attention car les deux méthodes s'appelent pareil, + + // il faut faire attention à ne pas confondre avec la méthode Count() de l'interface ITitreRepository return count; } @@ -62,14 +64,14 @@ public class LocalTitreRepository : ITitreRepository /// public void IncrementNbLikes(Titre titre) { - titre.NbLikes++; + titre.NbLikes++; // TODO rien n'est enregistré } /// public IEnumerable Search(string mot) { return this.dataStore.Titres - .Where(t => t.Libelle != null && t.Libelle.Contains(mot)); + .Where(t => t.Libelle != null && t.Libelle.Contains(mot)); // TODO attention au null, et à la casse, et à l'indexation pour les performances } /// diff --git a/Webzine.WebApplication/Areas/Administration/Controllers/DashboardController.cs b/Webzine.WebApplication/Areas/Administration/Controllers/DashboardController.cs index 2f314ad..753ebeb 100644 --- a/Webzine.WebApplication/Areas/Administration/Controllers/DashboardController.cs +++ b/Webzine.WebApplication/Areas/Administration/Controllers/DashboardController.cs @@ -6,7 +6,7 @@ using Webzine.Repository.Contracts; using Webzine.WebApplication.Areas.Administration.ViewModels; [Area("Administration")] -public class DashboardController : Controller +public class DashboardController : Controller // TODO à refaire { private readonly ILogger logger; private readonly IStyleRepository styleRepository; diff --git a/Webzine.WebApplication/Controllers/RechercheController.cs b/Webzine.WebApplication/Controllers/RechercheController.cs index 2d5c4b9..be5b50f 100644 --- a/Webzine.WebApplication/Controllers/RechercheController.cs +++ b/Webzine.WebApplication/Controllers/RechercheController.cs @@ -9,12 +9,21 @@ namespace Webzine.WebApplication.Controllers using Webzine.Repository.Contracts; using Webzine.WebApplication.ViewModels.Recherche; + /// + /// Controller de la page de recherche d'artistes et de titres. + /// public class RechercheController : Controller { private readonly ILogger logger; private readonly ITitreRepository titreRepository; private readonly IArtisteRepository artisteRepository; + /// + /// Constructeur du controller de la page de recherche d'artistes et de titres. + /// + /// Le logger pour enregistrer les événements. + /// Le repository pour gérer les opérations sur les titres. + /// Le repository pour gérer les opérations sur les artistes. public RechercheController( ILogger logger, ITitreRepository titreRepository, @@ -29,7 +38,7 @@ namespace Webzine.WebApplication.Controllers /// Affichage de la page Recherche depuis le header de l'app. /// /// Nom d'artiste ou de titre. - /// Page de recherche avec les résultats. + /// Page de recherche avec les r�sultats. public IActionResult Index(string mot) { // Logger la recherche. @@ -41,7 +50,7 @@ namespace Webzine.WebApplication.Controllers // Recherche des artistes. var artistes = this.artisteRepository.Search(mot); - // Paramètres a retourner à la vue. + // Param�tres a retourner � la vue. var vm = new RechercheIndexViewModel { Mot = mot, diff --git a/Webzine.WebApplication/Controllers/TitreController.cs b/Webzine.WebApplication/Controllers/TitreController.cs index 01b1239..60c3ae0 100644 --- a/Webzine.WebApplication/Controllers/TitreController.cs +++ b/Webzine.WebApplication/Controllers/TitreController.cs @@ -82,7 +82,7 @@ namespace Webzine.WebApplication.Controllers /// /// Nom du style musical. /// Vue contenant la liste filtree. - [HttpGet("style/{style}")] + [HttpGet("style/{style}")] // TODO pas de route écrite en dur dans le controller public IActionResult Style(string style) { this.logger.LogInformation("Recherche des titres pour le style : {Style}.", style); diff --git a/Webzine.WebApplication/Program.cs b/Webzine.WebApplication/Program.cs index 916d86e..701b4ca 100644 --- a/Webzine.WebApplication/Program.cs +++ b/Webzine.WebApplication/Program.cs @@ -2,10 +2,8 @@ #pragma warning disable SA1200 using Microsoft.EntityFrameworkCore; - using NLog; using NLog.Web; - using Webzine.EntitiesContext; using Webzine.Entity; using Webzine.Entity.Fixtures;