Include Manga and Chapter in jobs

This commit is contained in:
Glax 2024-12-16 23:05:12 +01:00
parent e66ab49e7d
commit 6940e6c64d

View File

@ -44,12 +44,22 @@ public class PgsqlContext(DbContextOptions<PgsqlContext> options) : DbContext(op
.HasValue<Gotify>(NotificationConnectorType.Gotify) .HasValue<Gotify>(NotificationConnectorType.Gotify)
.HasValue<Ntfy>(NotificationConnectorType.Ntfy) .HasValue<Ntfy>(NotificationConnectorType.Ntfy)
.HasValue<Lunasea>(NotificationConnectorType.LunaSea); .HasValue<Lunasea>(NotificationConnectorType.LunaSea);
modelBuilder.Entity<Job>() modelBuilder.Entity<Job>()
.HasDiscriminator<JobType>(j => j.JobType) .HasDiscriminator<JobType>(j => j.JobType)
.HasValue<MoveFileOrFolderJob>(JobType.MoveFileOrFolderJob) .HasValue<MoveFileOrFolderJob>(JobType.MoveFileOrFolderJob)
.HasValue<DownloadNewChaptersJob>(JobType.DownloadNewChaptersJob) .HasValue<DownloadNewChaptersJob>(JobType.DownloadNewChaptersJob)
.HasValue<DownloadSingleChapterJob>(JobType.DownloadSingleChapterJob) .HasValue<DownloadSingleChapterJob>(JobType.DownloadSingleChapterJob)
.HasValue<UpdateMetadataJob>(JobType.UpdateMetaDataJob); .HasValue<UpdateMetadataJob>(JobType.UpdateMetaDataJob);
modelBuilder.Entity<DownloadNewChaptersJob>()
.Navigation(dncj => dncj.Manga)
.AutoInclude();
modelBuilder.Entity<DownloadSingleChapterJob>()
.Navigation(dscj => dscj.Chapter)
.AutoInclude();
modelBuilder.Entity<UpdateMetadataJob>()
.Navigation(umj => umj.Manga)
.AutoInclude();
modelBuilder.Entity<Manga>() modelBuilder.Entity<Manga>()
.HasOne<MangaConnector>(m => m.MangaConnector); .HasOne<MangaConnector>(m => m.MangaConnector);