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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SVSim.Database.Migrations
{
/// <inheritdoc />
public partial class AddTutorialPresentEntries : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TutorialPresentEntries",
columns: table => new
{
PresentId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
RewardType = table.Column<int>(type: "integer", nullable: false),
RewardDetailId = table.Column<long>(type: "bigint", nullable: false),
RewardCount = table.Column<long>(type: "bigint", nullable: false),
ItemType = table.Column<int>(type: "integer", nullable: true),
Message = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TutorialPresentEntries", x => x.PresentId);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TutorialPresentEntries");
}
}
}

View File

@@ -2530,6 +2530,33 @@ namespace SVSim.Database.Migrations
b.ToTable("StoryDecks");
});
modelBuilder.Entity("SVSim.Database.Models.TutorialPresentEntry", b =>
{
b.Property<string>("PresentId")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<int?>("ItemType")
.HasColumnType("integer");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("text");
b.Property<long>("RewardCount")
.HasColumnType("bigint");
b.Property<long>("RewardDetailId")
.HasColumnType("bigint");
b.Property<int>("RewardType")
.HasColumnType("integer");
b.HasKey("PresentId");
b.ToTable("TutorialPresentEntries");
});
modelBuilder.Entity("SVSim.Database.Models.UnlimitedRestrictionEntry", b =>
{
b.Property<long>("Id")