From 82489f387000f0b67281499925463c68f8728cde Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 27 Sep 2025 22:41:59 +0200 Subject: [PATCH] Include Filename in Chapter DTO --- API/Controllers/DTOs/Chapter.cs | 9 ++++++++- API/Controllers/MangaController.cs | 12 ++++++------ API/Controllers/QueryController.cs | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/API/Controllers/DTOs/Chapter.cs b/API/Controllers/DTOs/Chapter.cs index f7ec832..f9eae85 100644 --- a/API/Controllers/DTOs/Chapter.cs +++ b/API/Controllers/DTOs/Chapter.cs @@ -6,7 +6,7 @@ namespace API.Controllers.DTOs; /// /// DTO /// -public sealed record Chapter(string Key, string MangaId, int? Volume, string ChapterNumber, string? Title, IEnumerable MangaConnectorIds, bool Downloaded) : Identifiable(Key) +public sealed record Chapter(string Key, string MangaId, int? Volume, string ChapterNumber, string? Title, IEnumerable MangaConnectorIds, bool Downloaded, string FileName) : Identifiable(Key) { /// /// Identifier of the Manga this Chapter belongs to @@ -49,4 +49,11 @@ public sealed record Chapter(string Key, string MangaId, int? Volume, string Cha [Required] [Description("Ids of the Manga on MangaConnectors")] public IEnumerable MangaConnectorIds { get; init; } = MangaConnectorIds; + + /// + /// Filename of the archive + /// + [Required] + [Description("Filename of the archive")] + public string FileName { get; init; } = FileName; } \ No newline at end of file diff --git a/API/Controllers/MangaController.cs b/API/Controllers/MangaController.cs index 3992fe0..5af5aba 100644 --- a/API/Controllers/MangaController.cs +++ b/API/Controllers/MangaController.cs @@ -217,7 +217,7 @@ public class MangaController(MangaContext context) : Controller { if (Tranga.GetRunningWorkers().Any(worker => worker is DownloadCoverFromMangaconnectorWorker w && context.MangaConnectorToManga.Find(w.MangaConnectorIdId)?.ObjId == MangaId)) { - Response.Headers.Append("Retry-After", $"{Tranga.Settings.WorkCycleTimeoutMs * 2 / 1000:D}"); + Response.Headers.Append("Retry-After","2"); return TypedResults.StatusCode(Status503ServiceUnavailable); } return TypedResults.NoContent(); @@ -254,7 +254,7 @@ public class MangaController(MangaContext context) : Controller { IEnumerable ids = c.MangaConnectorIds.Select(id => new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload)); - return new Chapter(c.Key, c.ParentMangaId, c.VolumeNumber, c.ChapterNumber, c.Title, ids, c.Downloaded); + return new Chapter(c.Key, c.ParentMangaId, c.VolumeNumber, c.ChapterNumber, c.Title, ids, c.Downloaded, c.FileName); }).ToList(); return TypedResults.Ok(chapters); @@ -284,7 +284,7 @@ public class MangaController(MangaContext context) : Controller { IEnumerable ids = c.MangaConnectorIds.Select(id => new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload)); - return new Chapter(c.Key, c.ParentMangaId, c.VolumeNumber, c.ChapterNumber, c.Title, ids, c.Downloaded); + return new Chapter(c.Key, c.ParentMangaId, c.VolumeNumber, c.ChapterNumber, c.Title, ids, c.Downloaded, c.FileName); }).ToList(); if (chapters.Count == 0) @@ -317,7 +317,7 @@ public class MangaController(MangaContext context) : Controller { IEnumerable ids = c.MangaConnectorIds.Select(id => new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload)); - return new Chapter(c.Key, c.ParentMangaId, c.VolumeNumber, c.ChapterNumber, c.Title, ids, c.Downloaded); + return new Chapter(c.Key, c.ParentMangaId, c.VolumeNumber, c.ChapterNumber, c.Title, ids, c.Downloaded, c.FileName); }).ToList(); if (chapters.Count == 0) @@ -370,7 +370,7 @@ public class MangaController(MangaContext context) : Controller IEnumerable ids = max.MangaConnectorIds.Select(id => new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload)); - return TypedResults.Ok(new Chapter(max.Key, max.ParentMangaId, max.VolumeNumber, max.ChapterNumber, max.Title,ids, max.Downloaded)); + return TypedResults.Ok(new Chapter(max.Key, max.ParentMangaId, max.VolumeNumber, max.ChapterNumber, max.Title,ids, max.Downloaded, max.FileName)); } /// @@ -412,7 +412,7 @@ public class MangaController(MangaContext context) : Controller IEnumerable ids = max.MangaConnectorIds.Select(id => new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload)); - return TypedResults.Ok(new Chapter(max.Key, max.ParentMangaId, max.VolumeNumber, max.ChapterNumber, max.Title,ids, max.Downloaded)); + return TypedResults.Ok(new Chapter(max.Key, max.ParentMangaId, max.VolumeNumber, max.ChapterNumber, max.Title,ids, max.Downloaded, max.FileName)); } /// diff --git a/API/Controllers/QueryController.cs b/API/Controllers/QueryController.cs index ba3fa7c..394994d 100644 --- a/API/Controllers/QueryController.cs +++ b/API/Controllers/QueryController.cs @@ -51,7 +51,7 @@ public class QueryController(MangaContext context) : Controller IEnumerable ids = chapter.MangaConnectorIds.Select(id => new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload)); - return TypedResults.Ok(new Chapter(chapter.Key, chapter.ParentMangaId, chapter.VolumeNumber, chapter.ChapterNumber, chapter.Title,ids, chapter.Downloaded)); + return TypedResults.Ok(new Chapter(chapter.Key, chapter.ParentMangaId, chapter.VolumeNumber, chapter.ChapterNumber, chapter.Title,ids, chapter.Downloaded, chapter.FileName)); } ///