feat: Jobs infrastructure, endpoints, UI and worker prioritization
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user