Refactor app architecture and clean local artifacts
This commit is contained in:
@@ -16,6 +16,7 @@ public sealed class AwardsDbContext(DbContextOptions<AwardsDbContext> options) :
|
||||
public DbSet<RiskFlag> RiskFlags => Set<RiskFlag>();
|
||||
public DbSet<AdminAuditEntry> AdminAuditEntries => Set<AdminAuditEntry>();
|
||||
public DbSet<ClipSubmission> ClipSubmissions => Set<ClipSubmission>();
|
||||
public DbSet<SiteSettings> SiteSettings => Set<SiteSettings>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -23,9 +24,29 @@ public sealed class AwardsDbContext(DbContextOptions<AwardsDbContext> options) :
|
||||
{
|
||||
entity.HasIndex(item => item.Year).IsUnique();
|
||||
entity.Property(item => item.Name).HasMaxLength(160);
|
||||
entity.Property(item => item.ShowStreamUrl).HasMaxLength(400);
|
||||
entity.Property(item => item.CurrentPhase).HasMaxLength(60);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<SiteSettings>(entity =>
|
||||
{
|
||||
entity.Property(item => item.HostDisplayName).HasMaxLength(120);
|
||||
entity.Property(item => item.HostTagline).HasMaxLength(160);
|
||||
entity.Property(item => item.NewsletterUrl).HasMaxLength(400);
|
||||
entity.Property(item => item.PrivacyEmail).HasMaxLength(160);
|
||||
entity.Property(item => item.PrivacyPolicyUpdatedBy).HasMaxLength(120);
|
||||
entity.Property(item => item.ImprintUrl).HasMaxLength(400);
|
||||
entity.Property(item => item.ContactUrl).HasMaxLength(400);
|
||||
entity.Property(item => item.SponsorsUrl).HasMaxLength(400);
|
||||
entity.Property(item => item.DemoLoginEmail).HasMaxLength(180);
|
||||
entity.Property(item => item.DemoLoginPasswordHash).HasMaxLength(120);
|
||||
entity.Property(item => item.DemoLoginPasswordSalt).HasMaxLength(80);
|
||||
entity.Property(item => item.DemoLoginTwitchUserId).HasMaxLength(120);
|
||||
entity.Property(item => item.DemoLoginDisplayName).HasMaxLength(120);
|
||||
entity.Property(item => item.MaintenanceTitle).HasMaxLength(120);
|
||||
entity.Property(item => item.MaintenanceMessage).HasMaxLength(600);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Category>(entity =>
|
||||
{
|
||||
entity.HasIndex(item => new { item.SeasonId, item.Slug }).IsUnique();
|
||||
@@ -45,6 +66,11 @@ public sealed class AwardsDbContext(DbContextOptions<AwardsDbContext> options) :
|
||||
{
|
||||
entity.Property(item => item.SubmittedByTwitchId).HasMaxLength(120);
|
||||
entity.Property(item => item.CandidateText).HasMaxLength(120);
|
||||
entity.Property(item => item.StreamUrl).HasMaxLength(300);
|
||||
entity.Property(item => item.Status).HasMaxLength(20);
|
||||
entity.Property(item => item.ReviewNote).HasMaxLength(500);
|
||||
entity.Property(item => item.ReviewedByTwitchId).HasMaxLength(120);
|
||||
entity.HasIndex(item => new { item.SeasonId, item.Status });
|
||||
});
|
||||
|
||||
modelBuilder.Entity<VoteBallot>(entity =>
|
||||
@@ -55,6 +81,7 @@ public sealed class AwardsDbContext(DbContextOptions<AwardsDbContext> options) :
|
||||
|
||||
modelBuilder.Entity<AwardResult>(entity =>
|
||||
{
|
||||
entity.HasIndex(item => new { item.SeasonId, item.CategoryId }).IsUnique();
|
||||
entity.Property(item => item.CategoryName).HasMaxLength(120);
|
||||
});
|
||||
|
||||
@@ -79,6 +106,7 @@ public sealed class AwardsDbContext(DbContextOptions<AwardsDbContext> options) :
|
||||
entity.Property(item => item.Summary).HasMaxLength(240);
|
||||
entity.Property(item => item.CreatedFromIp).HasMaxLength(80);
|
||||
entity.Property(item => item.UserAgent).HasMaxLength(400);
|
||||
entity.Property(item => item.ReviewNote).HasMaxLength(500);
|
||||
entity.Property(item => item.ReviewedByTwitchId).HasMaxLength(120);
|
||||
});
|
||||
|
||||
@@ -89,6 +117,8 @@ public sealed class AwardsDbContext(DbContextOptions<AwardsDbContext> options) :
|
||||
entity.Property(item => item.EntityType).HasMaxLength(80);
|
||||
entity.Property(item => item.EntityId).HasMaxLength(120);
|
||||
entity.Property(item => item.Summary).HasMaxLength(240);
|
||||
entity.Property(item => item.CreatedFromIp).HasMaxLength(80);
|
||||
entity.Property(item => item.UserAgent).HasMaxLength(400);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ClipSubmission>(entity =>
|
||||
@@ -99,8 +129,15 @@ public sealed class AwardsDbContext(DbContextOptions<AwardsDbContext> options) :
|
||||
entity.Property(item => item.Creator).HasMaxLength(120);
|
||||
entity.Property(item => item.Platform).HasMaxLength(40);
|
||||
entity.Property(item => item.Status).HasMaxLength(20);
|
||||
entity.Property(item => item.ReviewNote).HasMaxLength(500);
|
||||
entity.Property(item => item.ReviewedByTwitchId).HasMaxLength(120);
|
||||
entity.Property(item => item.CreatedFromIp).HasMaxLength(80);
|
||||
entity.HasIndex(item => new { item.SeasonId, item.Status });
|
||||
entity.HasIndex(item => item.CandidateId);
|
||||
entity.HasOne(item => item.Candidate)
|
||||
.WithMany()
|
||||
.HasForeignKey(item => item.CandidateId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
SeedData.Apply(modelBuilder);
|
||||
|
||||
Reference in New Issue
Block a user