Add endpoint that fetches all Metadataentries for Manga

This commit is contained in:
2025-10-14 10:42:30 +02:00
parent 4281c93f9a
commit b6aab4eb8d
2 changed files with 56 additions and 1 deletions

View File

@@ -36,12 +36,28 @@ public class MetadataFetcherController(MangaContext context) : Controller
[ProducesResponseType(Status500InternalServerError)]
public async Task<Results<Ok<List<MetadataEntry>>, InternalServerError>> GetLinkedEntries ()
{
if (await context.MetadataEntries.ToListAsync() is not { } result)
if (await context.MetadataEntries.ToListAsync(HttpContext.RequestAborted) is not { } result)
return TypedResults.InternalServerError();
return TypedResults.Ok(result);
}
/// <summary>
/// Returns all <see cref="MetadataEntry"/> for <see cref="Manga"/> with <paramref name="MangaId"/>
/// </summary>
/// <response code="200"></response>
/// <response code="404"><see cref="Manga"/> with <paramref name="MangaId"/> not found</response>
[HttpGet("Links/{MangaId}")]
[ProducesResponseType<List<MetadataEntry>>(Status200OK, "application/json")]
[ProducesResponseType(Status500InternalServerError)]
public async Task<Results<Ok<List<MetadataEntry>>, NotFound<string>>> GetLinkedEntries(string MangaId)
{
if (await context.MetadataEntries.Where(me => me.MangaId == MangaId).ToListAsync(HttpContext.RequestAborted) is not { } result)
return TypedResults.NotFound(nameof(MangaId));
return TypedResults.Ok(result);
}
/// <summary>
/// Searches <see cref="MetadataFetcher"/> (Metadata-Sites) for Manga-Metadata
/// </summary>

View File

@@ -1673,6 +1673,45 @@
}
}
},
"/v2/MetadataFetcher/Links/{MangaId}": {
"get": {
"tags": [
"MetadataFetcher"
],
"summary": "Returns all API.Schema.MangaContext.MetadataFetchers.MetadataEntry for API.Schema.MangaContext.Manga with MangaId",
"parameters": [
{
"name": "MangaId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json; x-version=2.0": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MetadataEntry"
}
}
}
}
},
"500": {
"description": "Internal Server Error"
},
"404": {
"description": "API.Schema.MangaContext.Manga with MangaId not found"
}
}
}
},
"/v2/MetadataFetcher/{MetadataFetcherName}/SearchManga/{MangaId}": {
"post": {
"tags": [