refactor(tutorial-presents): promote static catalogue to seed-driven TutorialPresentEntries table

The five tutorial gifts every fresh viewer is given at signup used to live as a
static C# array in SVSim.Database/SeedData/TutorialPresents.cs — outside the
seed-JSON pipeline used by all 40+ other globals tables. Editing a gift required
a code change + rebuild instead of a JSON edit + bootstrap re-run.

Now authored in SVSim.Bootstrap/Data/seeds/tutorial-presents.json and loaded into
a new TutorialPresentEntries table via TutorialPresentsImporter (clear-and-rewrite,
mirroring HomeDialogs). ViewerRepository.RegisterAnonymousViewer reads the table
at signup and projects each row into a ViewerPresent with Source="tutorial".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-09 09:53:10 -04:00
parent 7118b92522
commit 998402ebc3
12 changed files with 4434 additions and 39 deletions

View File

@@ -102,6 +102,7 @@ public class SVSimDbContext : DbContext
public DbSet<ViewerStoryBranchUnlock> ViewerStoryBranchUnlocks => Set<ViewerStoryBranchUnlock>();
public DbSet<ViewerPresent> ViewerPresents => Set<ViewerPresent>();
public DbSet<TutorialPresentEntry> TutorialPresentEntries => Set<TutorialPresentEntry>();
public DbSet<ArenaTwoPickReward> ArenaTwoPickRewards { get; set; } = null!;
public DbSet<ViewerArenaTwoPickRun> ViewerArenaTwoPickRuns { get; set; } = null!;
@@ -391,6 +392,12 @@ public class SVSimDbContext : DbContext
b.HasIndex(p => new { p.ViewerId, p.PresentId }).IsUnique();
});
modelBuilder.Entity<TutorialPresentEntry>(b =>
{
b.HasKey(p => p.PresentId);
b.Property(p => p.PresentId).HasMaxLength(64);
});
base.OnModelCreating(modelBuilder);
}