Return all Manga by default, add endpoint to return Mangakeys

This commit is contained in:
2025-09-01 21:22:29 +02:00
parent 94a8dfc90a
commit b4a0ce68c3

View File

@@ -20,16 +20,27 @@ namespace API.Controllers;
[Route("v{v:apiVersion}/[controller]")] [Route("v{v:apiVersion}/[controller]")]
public class MangaController(MangaContext context) : Controller public class MangaController(MangaContext context) : Controller
{ {
/// <summary> /// <summary>
/// Returns all cached <see cref="Manga"/> /// Returns all cached <see cref="Manga"/>
/// </summary> /// </summary>
/// <response code="200"><see cref="Manga"/> Keys/IDs</response> /// <response code="200"></response>
[HttpGet] [HttpGet]
[ProducesResponseType<string[]>(Status200OK, "application/json")] [ProducesResponseType<Manga[]>(Status200OK, "application/json")]
public IActionResult GetAllManga() public IActionResult GetAllManga()
{ {
string[] ret = context.Mangas.Select(m => m.Key).ToArray(); return Ok(context.Mangas.ToArray());
return Ok(ret); }
/// <summary>
/// Returns all cached <see cref="Manga"/>.Keys
/// </summary>
/// <response code="200"><see cref="Manga"/> Keys/IDs</response>
[HttpGet("Keys")]
[ProducesResponseType<string[]>(Status200OK, "application/json")]
public IActionResult GetAllMangaKeys()
{
return Ok(context.Mangas.Select(m => m.Key).ToArray());
} }
/// <summary> /// <summary>