mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-11 05:09:49 +02:00
Include Filename in Chapter DTO
This commit is contained in:
@@ -6,7 +6,7 @@ namespace API.Controllers.DTOs;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="API.Schema.MangaContext.Chapter"/> DTO
|
/// <see cref="API.Schema.MangaContext.Chapter"/> DTO
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed record Chapter(string Key, string MangaId, int? Volume, string ChapterNumber, string? Title, IEnumerable<MangaConnectorId> MangaConnectorIds, bool Downloaded) : Identifiable(Key)
|
public sealed record Chapter(string Key, string MangaId, int? Volume, string ChapterNumber, string? Title, IEnumerable<MangaConnectorId> MangaConnectorIds, bool Downloaded, string FileName) : Identifiable(Key)
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifier of the Manga this Chapter belongs to
|
/// 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]
|
[Required]
|
||||||
[Description("Ids of the Manga on MangaConnectors")]
|
[Description("Ids of the Manga on MangaConnectors")]
|
||||||
public IEnumerable<MangaConnectorId> MangaConnectorIds { get; init; } = MangaConnectorIds;
|
public IEnumerable<MangaConnectorId> MangaConnectorIds { get; init; } = MangaConnectorIds;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Filename of the archive
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[Description("Filename of the archive")]
|
||||||
|
public string FileName { get; init; } = FileName;
|
||||||
}
|
}
|
@@ -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))
|
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.StatusCode(Status503ServiceUnavailable);
|
||||||
}
|
}
|
||||||
return TypedResults.NoContent();
|
return TypedResults.NoContent();
|
||||||
@@ -254,7 +254,7 @@ public class MangaController(MangaContext context) : Controller
|
|||||||
{
|
{
|
||||||
IEnumerable<MangaConnectorId> ids = c.MangaConnectorIds.Select(id =>
|
IEnumerable<MangaConnectorId> ids = c.MangaConnectorIds.Select(id =>
|
||||||
new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload));
|
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();
|
}).ToList();
|
||||||
|
|
||||||
return TypedResults.Ok(chapters);
|
return TypedResults.Ok(chapters);
|
||||||
@@ -284,7 +284,7 @@ public class MangaController(MangaContext context) : Controller
|
|||||||
{
|
{
|
||||||
IEnumerable<MangaConnectorId> ids = c.MangaConnectorIds.Select(id =>
|
IEnumerable<MangaConnectorId> ids = c.MangaConnectorIds.Select(id =>
|
||||||
new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload));
|
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();
|
}).ToList();
|
||||||
|
|
||||||
if (chapters.Count == 0)
|
if (chapters.Count == 0)
|
||||||
@@ -317,7 +317,7 @@ public class MangaController(MangaContext context) : Controller
|
|||||||
{
|
{
|
||||||
IEnumerable<MangaConnectorId> ids = c.MangaConnectorIds.Select(id =>
|
IEnumerable<MangaConnectorId> ids = c.MangaConnectorIds.Select(id =>
|
||||||
new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload));
|
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();
|
}).ToList();
|
||||||
|
|
||||||
if (chapters.Count == 0)
|
if (chapters.Count == 0)
|
||||||
@@ -370,7 +370,7 @@ public class MangaController(MangaContext context) : Controller
|
|||||||
|
|
||||||
IEnumerable<MangaConnectorId> ids = max.MangaConnectorIds.Select(id =>
|
IEnumerable<MangaConnectorId> ids = max.MangaConnectorIds.Select(id =>
|
||||||
new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -412,7 +412,7 @@ public class MangaController(MangaContext context) : Controller
|
|||||||
|
|
||||||
IEnumerable<MangaConnectorId> ids = max.MangaConnectorIds.Select(id =>
|
IEnumerable<MangaConnectorId> ids = max.MangaConnectorIds.Select(id =>
|
||||||
new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -51,7 +51,7 @@ public class QueryController(MangaContext context) : Controller
|
|||||||
|
|
||||||
IEnumerable<MangaConnectorId> ids = chapter.MangaConnectorIds.Select(id =>
|
IEnumerable<MangaConnectorId> ids = chapter.MangaConnectorIds.Select(id =>
|
||||||
new MangaConnectorId(id.Key, id.MangaConnectorName, id.ObjId, id.WebsiteUrl, id.UseForDownload));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Reference in New Issue
Block a user