#211 : Optimisation de la recherche des dernières chroniques et des titres les plus populaires.

This commit is contained in:
Loic Masi
2026-04-08 18:38:46 +02:00
parent 6118aa9af8
commit b754d0104b
4 changed files with 94 additions and 6 deletions

View File

@@ -181,4 +181,39 @@ public class LocalTitreRepository : ITitreRepository
return titre == null ? null : (titre.IdTitre, titre.Libelle);
}
/// <inheritdoc/>
public IEnumerable<Titre> DerniereChronique(int offset, int limit)
{
try
{
return this.dataStore.Titres
.OrderByDescending(t => t.DateCreation)
.Paginate(offset, limit);
}
catch (Exception ex)
{
this.logger.LogError(ex, "Erreur lors de la recuperation des dernieres chroniques.");
throw;
}
}
/// <inheritdoc/>
public IEnumerable<Titre> TopTitre(int offset, int limit)
{
try
{
this.logger.LogInformation("Récupération du Top Titre.");
var titres = this.dataStore.Titres
.OrderByDescending(t => t.NbLikes)
.Paginate(offset, limit);
return titres;
}
catch (Exception ex)
{
this.logger.LogError(ex, "Erreur lors de la récupération du Top Titre.");
throw;
}
}
}