Manga latest downloaded and available via SQL Queries

This commit is contained in:
2024-12-18 16:42:59 +01:00
parent 5494f2b754
commit 55c0e2c4e7
14 changed files with 16 additions and 24 deletions

View File

@ -125,9 +125,11 @@ public class MangaController(PgsqlContext context) : Controller
Manga? m = context.Manga.Find(id);
if (m is null)
return NotFound("Manga could not be found");
if (m.LatestChapterAvailable is null)
List<Chapter> chapters = context.Chapters.Where(c => c.ParentManga.MangaId == m.MangaId).ToList();
Chapter? max = chapters.Max();
if (max is null)
return NotFound("Chapter could not be found");
return Ok(m.LatestChapterAvailable);
return Ok(max);
}
/// <summary>