Tranga/API/Schema/Jobs/DownloadAvailableChaptersJob.cs
Glax a490e233d7
Some checks failed
Docker Image CI / build (push) Has been cancelled
Jobs remove redundant fields (context tracking)
2025-04-02 02:16:55 +02:00

17 lines
745 B
C#

using System.ComponentModel.DataAnnotations;
namespace API.Schema.Jobs;
public class DownloadAvailableChaptersJob(ulong recurrenceMs, string mangaId, string? parentJobId = null, ICollection<string>? dependsOnJobsIds = null)
: Job(TokenGen.CreateToken(typeof(DownloadAvailableChaptersJob)), JobType.DownloadAvailableChaptersJob, recurrenceMs, parentJobId, dependsOnJobsIds)
{
[StringLength(64)]
[Required]
public string MangaId { get; init; } = mangaId;
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
{
return context.Chapters.Where(c => c.ParentMangaId == MangaId).AsEnumerable()
.Select(chapter => new DownloadSingleChapterJob(chapter.ChapterId, this.JobId));
}
}