feat: Jobs infrastructure, endpoints, UI and worker prioritization

This commit is contained in:
Richard
2026-07-06 19:58:23 +02:00
parent 33a52ed173
commit fb703b6c81
9 changed files with 321 additions and 26 deletions
@@ -20,6 +20,7 @@ public class AppDbContext : DbContext
public DbSet<MarketOutcomePriceSnapshot> MarketOutcomePriceSnapshots => Set<MarketOutcomePriceSnapshot>();
public DbSet<TraderCategoryPerformance> TraderCategoryPerformances => Set<TraderCategoryPerformance>();
public DbSet<TradeContext> TradeContexts => Set<TradeContext>();
public DbSet<BackgroundJob> BackgroundJobs => Set<BackgroundJob>();
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
@@ -220,5 +221,17 @@ public class AppDbContext : DbContext
e.Property(ps => ps.Price).HasPrecision(10, 6);
e.HasOne(ps => ps.MarketOutcome).WithMany().HasForeignKey(ps => ps.MarketOutcomeId).OnDelete(DeleteBehavior.Cascade);
});
// BackgroundJob
mb.Entity<BackgroundJob>(e =>
{
e.HasKey(j => j.Id);
e.HasIndex(j => j.Status);
e.HasIndex(j => j.JobType);
e.Property(j => j.JobType).HasConversion<string>().HasMaxLength(64);
e.Property(j => j.Status).HasConversion<string>().HasMaxLength(64);
e.Property(j => j.ErrorMessage).HasMaxLength(4096);
e.HasOne(j => j.Trader).WithMany().HasForeignKey(j => j.TraderId).OnDelete(DeleteBehavior.SetNull);
});
}
}