From b6aab4eb8db3e3889519febd4c418a711dad931b Mon Sep 17 00:00:00 2001 From: glax Date: Tue, 14 Oct 2025 10:42:30 +0200 Subject: [PATCH] Add endpoint that fetches all Metadataentries for Manga --- API/Controllers/MetadataFetcherController.cs | 18 ++++++++- API/openapi/API_v2.json | 39 ++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/API/Controllers/MetadataFetcherController.cs b/API/Controllers/MetadataFetcherController.cs index 353b402..6d6d943 100644 --- a/API/Controllers/MetadataFetcherController.cs +++ b/API/Controllers/MetadataFetcherController.cs @@ -36,12 +36,28 @@ public class MetadataFetcherController(MangaContext context) : Controller [ProducesResponseType(Status500InternalServerError)] public async Task>, 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); } + /// + /// Returns all for with + /// + /// + /// with not found + [HttpGet("Links/{MangaId}")] + [ProducesResponseType>(Status200OK, "application/json")] + [ProducesResponseType(Status500InternalServerError)] + public async Task>, NotFound>> 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); + } + /// /// Searches (Metadata-Sites) for Manga-Metadata /// diff --git a/API/openapi/API_v2.json b/API/openapi/API_v2.json index 2baf936..5c53f52 100644 --- a/API/openapi/API_v2.json +++ b/API/openapi/API_v2.json @@ -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": [