[FA-misc] Saga seems to work, fixed a UserNovelDataService bug

This commit is contained in:
gamer147
2026-01-28 12:11:06 -05:00
parent 579e05b853
commit ec967770d3
34 changed files with 1341 additions and 97 deletions

View File

@@ -1,6 +1,8 @@
using FictionArchive.Service.NovelService.Models;
using FictionArchive.Service.NovelService.Models.Images;
using FictionArchive.Service.NovelService.Models.Localization;
using FictionArchive.Service.NovelService.Models.Novels;
using FictionArchive.Service.NovelService.Sagas;
using FictionArchive.Service.Shared.Services.Database;
using Microsoft.EntityFrameworkCore;
@@ -18,6 +20,8 @@ public class NovelServiceDbContext(DbContextOptions options, ILogger<NovelServic
public DbSet<LocalizationKey> LocalizationKeys { get; set; }
public DbSet<LocalizationRequest> LocalizationRequests { get; set; }
public DbSet<Image> Images { get; set; }
public DbSet<ActiveImport> ActiveImports { get; set; }
public DbSet<NovelImportSagaState> NovelImportSagaStates { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -36,5 +40,18 @@ public class NovelServiceDbContext(DbContextOptions options, ILogger<NovelServic
modelBuilder.Entity<Chapter>()
.HasIndex("VolumeId", "Order")
.IsUnique();
modelBuilder.Entity<ActiveImport>(entity =>
{
entity.HasKey(e => e.ImportId);
entity.HasIndex(e => e.NovelUrl).IsUnique();
});
modelBuilder.Entity<NovelImportSagaState>(entity =>
{
entity.HasKey(e => e.CorrelationId);
entity.HasIndex(e => e.NovelUrl);
entity.HasIndex(e => e.CurrentState);
});
}
}