From 496b49ccb363342ed4a63fef3f56a59336c57458 Mon Sep 17 00:00:00 2001 From: Glax Date: Sat, 17 May 2025 19:24:24 +0200 Subject: [PATCH] ParentJob can be updated, DownloadAvailableJobs Endpoint automatically sets ParentJob to the DownloadAvailableChaptersJob (ondeleteCascade) --- API/Controllers/JobController.cs | 2 ++ API/Schema/Jobs/Job.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/API/Controllers/JobController.cs b/API/Controllers/JobController.cs index 4f3ead0..c68f1c0 100644 --- a/API/Controllers/JobController.cs +++ b/API/Controllers/JobController.cs @@ -137,6 +137,8 @@ public class JobController(PgsqlContext context, ILog Log) : Controller Job updateFilesDownloaded = new UpdateChaptersDownloadedJob(m, record.recurrenceTimeMs, dependsOnJobs: [retrieveChapters]); Job downloadChapters = new DownloadAvailableChaptersJob(m, record.recurrenceTimeMs, dependsOnJobs: [retrieveChapters, updateFilesDownloaded]); + retrieveChapters.ParentJob = downloadChapters; + updateFilesDownloaded.ParentJob = retrieveChapters; return AddJobs([retrieveChapters, downloadChapters, updateFilesDownloaded]); } diff --git a/API/Schema/Jobs/Job.cs b/API/Schema/Jobs/Job.cs index ffcb227..ddb2774 100644 --- a/API/Schema/Jobs/Job.cs +++ b/API/Schema/Jobs/Job.cs @@ -15,8 +15,8 @@ public abstract class Job [Required] public string JobId { get; init; } - [StringLength(64)] public string? ParentJobId { get; init; } - [JsonIgnore] public Job? ParentJob { get; init; } + [StringLength(64)] public string? ParentJobId { get; private set; } + [JsonIgnore] public Job? ParentJob { get; internal set; } private ICollection _dependsOnJobs = null!; [JsonIgnore] public ICollection DependsOnJobs {