LibraryConnector-Updates work

Fixes #418
This commit is contained in:
2025-09-18 00:42:46 +02:00
parent 55fb37d62b
commit 5af1605c5b
16 changed files with 125 additions and 135 deletions

View File

@@ -1,7 +1,7 @@
using API.Schema.MangaContext;
using Microsoft.EntityFrameworkCore;
namespace API.Workers;
namespace API.Workers.PeriodicWorkers;
/// <summary>
/// Creates Jobs to update available Chapters for all Manga that are marked for Download

View File

@@ -1,6 +1,6 @@
using API.Schema.MangaContext;
namespace API.Workers.MaintenanceWorkers;
namespace API.Workers.PeriodicWorkers.MaintenanceWorkers;
public class CleanupMangaCoversWorker(TimeSpan? interval = null, IEnumerable<BaseWorker>? dependsOn = null)
: BaseWorkerWithContext<MangaContext>(dependsOn), IPeriodic

View File

@@ -1,7 +1,7 @@
using API.Schema.NotificationsContext;
using Microsoft.EntityFrameworkCore;
namespace API.Workers.MaintenanceWorkers;
namespace API.Workers.PeriodicWorkers.MaintenanceWorkers;
/// <summary>
/// Removes sent notifications from database

View File

@@ -2,7 +2,7 @@ using API.Schema.NotificationsContext;
using API.Schema.NotificationsContext.NotificationConnectors;
using Microsoft.EntityFrameworkCore;
namespace API.Workers;
namespace API.Workers.PeriodicWorkers;
/// <summary>
/// Send notifications to NotificationConnectors

View File

@@ -1,7 +1,7 @@
using API.Schema.MangaContext;
using Microsoft.EntityFrameworkCore;
namespace API.Workers;
namespace API.Workers.PeriodicWorkers;
/// <summary>
/// Create new Workers for Chapters on Manga marked for Download, that havent been downloaded yet.

View File

@@ -1,7 +1,7 @@
using API.Schema.MangaContext;
using Microsoft.EntityFrameworkCore;
namespace API.Workers;
namespace API.Workers.PeriodicWorkers;
/// <summary>
/// Updates the database to reflect changes made on disk

View File

@@ -1,7 +1,7 @@
using API.Schema.MangaContext;
using Microsoft.EntityFrameworkCore;
namespace API.Workers;
namespace API.Workers.PeriodicWorkers;
/// <summary>
/// Creates Workers to update covers for Manga

View File

@@ -0,0 +1,20 @@
using API.Schema.LibraryContext;
using API.Schema.LibraryContext.LibraryConnectors;
using Microsoft.EntityFrameworkCore;
namespace API.Workers.PeriodicWorkers;
public class UpdateLibraryConnectorsWorker(TimeSpan? interval = null, IEnumerable<BaseWorker>? dependsOn = null)
: BaseWorkerWithContext<LibraryContext>(dependsOn), IPeriodic
{
public DateTime LastExecution { get; set; } = DateTime.UnixEpoch;
public TimeSpan Interval { get; set; } = interval ?? TimeSpan.FromMinutes(10);
protected override async Task<BaseWorker[]> DoWorkInternal()
{
List<LibraryConnector> connectors = await DbContext.LibraryConnectors.ToListAsync(CancellationToken);
foreach (LibraryConnector libraryConnector in connectors)
await libraryConnector.UpdateLibrary(CancellationToken);
return [];
}
}

View File

@@ -2,7 +2,7 @@ using API.Schema.MangaContext;
using API.Schema.MangaContext.MetadataFetchers;
using Microsoft.EntityFrameworkCore;
namespace API.Workers;
namespace API.Workers.PeriodicWorkers;
/// <summary>
/// Updates Metadata for all Manga