feat(home-dialog): add HomeDialogEntry entity + migration
DDL-only per migrations-are-ddl-only convention. Seeded by SVSim.Bootstrap MyPageGlobalsImporter (T5) — no HasData. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
4143
SVSim.Database/Migrations/20260608225037_AddHomeDialogEntries.Designer.cs
generated
Normal file
4143
SVSim.Database/Migrations/20260608225037_AddHomeDialogEntries.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SVSim.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddHomeDialogEntries : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HomeDialogEntries",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false),
|
||||
TitleTextId = table.Column<string>(type: "text", nullable: false),
|
||||
Image = table.Column<string>(type: "text", nullable: false),
|
||||
ButtonListJson = table.Column<string>(type: "jsonb", nullable: false),
|
||||
BeginTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
EndTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: true),
|
||||
Priority = table.Column<int>(type: "integer", nullable: false),
|
||||
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HomeDialogEntries", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HomeDialogEntries_BeginTime_EndTime",
|
||||
table: "HomeDialogEntries",
|
||||
columns: new[] { "BeginTime", "EndTime" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_HomeDialogEntries_BeginTime_EndTime",
|
||||
table: "HomeDialogEntries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HomeDialogEntries");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1176,6 +1176,46 @@ namespace SVSim.Database.Migrations
|
||||
b.ToTable("GameConfigs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.HomeDialogEntry", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("BeginTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ButtonListJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("EndTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Image")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Priority")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TitleTextId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("HomeDialogEntries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ItemEntry", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
||||
31
SVSim.Database/Models/HomeDialogEntry.cs
Normal file
31
SVSim.Database/Models/HomeDialogEntry.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using SVSim.Database.Common;
|
||||
|
||||
namespace SVSim.Database.Models;
|
||||
|
||||
/// <summary>
|
||||
/// One mypage home-dialog popup from /mypage/index data.home_dialog_list. Id is authored in
|
||||
/// the seed file (no stable wire ID; see banners.json for the same pattern). The dialog fires
|
||||
/// once per viewer per server-process lifetime — see IHomeDialogSessionTracker.
|
||||
/// </summary>
|
||||
public class HomeDialogEntry : BaseEntity<int>
|
||||
{
|
||||
public string TitleTextId { get; set; } = string.Empty;
|
||||
public string Image { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>jsonb — List<HomeDialogButtonSeed> serialized verbatim. Deserialized in
|
||||
/// MyPageController via JsonbReadOptions.</summary>
|
||||
[Column(TypeName = "jsonb")]
|
||||
public string ButtonListJson { get; set; } = "[]";
|
||||
|
||||
public DateTime BeginTime { get; set; }
|
||||
public DateTime EndTime { get; set; }
|
||||
|
||||
/// <summary>Wire "type" — client parser ignores it but prod sends "1". Nullable so we
|
||||
/// omit when unset; serialized as a string per <c>HomeDialog.Type</c> on the DTO.</summary>
|
||||
public int? Type { get; set; }
|
||||
|
||||
/// <summary>Tiebreaker when multiple entries are active. Higher wins; ID asc breaks
|
||||
/// further ties. Each /mypage/index call emits the highest-priority unfired entry.</summary>
|
||||
public int Priority { get; set; }
|
||||
}
|
||||
@@ -62,6 +62,7 @@ public class SVSimDbContext : DbContext
|
||||
public DbSet<ViewerEventCounter> ViewerEventCounters => Set<ViewerEventCounter>();
|
||||
public DbSet<DailyLoginBonusEntry> DailyLoginBonuses => Set<DailyLoginBonusEntry>();
|
||||
public DbSet<BannerEntry> Banners => Set<BannerEntry>();
|
||||
public DbSet<HomeDialogEntry> HomeDialogEntries => Set<HomeDialogEntry>();
|
||||
public DbSet<ColosseumConfig> Colosseums => Set<ColosseumConfig>();
|
||||
public DbSet<SealedConfig> SealedSeasons => Set<SealedConfig>();
|
||||
public DbSet<MasterPointRankingPeriodEntry> MasterPointRankingPeriods => Set<MasterPointRankingPeriodEntry>();
|
||||
|
||||
Reference in New Issue
Block a user