refactor(arena-colosseum): dedup colosseum_info source-of-truth

/mypage/index data.colosseum_info and /arena_colosseum/{top,get_fee_info}
now both project through ColosseumLobbyInfoBuilder.Build(ColosseumSeasonConfig).
One source of truth for the home-tab gating and the lobby reads — admins
flip the season on by writing to GameConfigs (per the runbook), no second
table to keep in sync.

* New ColosseumLobbyInfoBuilder — static projection from ColosseumSeasonConfig
  to the wire ColosseumLobbyInfo. Replaces ArenaColosseumController's private
  BuildColosseumInfo and MyPageController's BuildColosseumInfo(ColosseumConfig).
* MyPageController reads ColosseumSeasonConfig via IGameConfigService; the
  IGlobalsRepository.GetCurrentColosseum() call goes away.
* MyPageIndexResponse.ColosseumInfo retyped to the new ColosseumLobbyInfo.
* ColosseumSalesPeriodInfo relocated into the ArenaColosseum namespace
  alongside the rest of the family DTOs.
* Drops: Colosseums DB table (migration DropColosseumsTable), ColosseumConfig
  entity, the captured-shape Models.Dtos.ColosseumInfo DTO, ColosseumSeed,
  MyPageGlobalsImporter.ImportColosseumAsync + seed file colosseum.json,
  IGlobalsRepository.GetCurrentColosseum + impl, the two related tests.

Net: home-screen Grand Prix tab now hidden by default because the season
ships with IsColosseumPeriod=false. Full suite: 1345/1345 (was 1347 — the
2 dropped tests covered the now-dead surface).
This commit is contained in:
gamer147
2026-06-13 13:31:03 -04:00
parent 114e3da81f
commit 43a3665775
22 changed files with 4924 additions and 413 deletions

View File

@@ -1,20 +0,0 @@
{
"id": 1,
"colosseum_id": "165",
"colosseum_name": "Rivenbrandt Take Two Cup",
"card_pool_name": "Take Two (DragonbladeRivenbrandt)",
"deck_format": "3",
"start_time": "2026-05-21 06:00:00",
"end_time": "2026-05-25 19:59:59",
"now_round": "1",
"is_display_tips": "0",
"tips_id": "0",
"is_colosseum_period": true,
"is_round_period": true,
"is_normal_two_pick": "1",
"is_special_mode": "10",
"is_all_card_enabled": 0,
"sales_period_info": {
"sales_period_time": "2026-05-25 19:59:59"
}
}

View File

@@ -81,42 +81,6 @@ public class MyPageGlobalsImporter
return seed.Count;
}
public async Task<int> ImportColosseumAsync(SVSimDbContext context, string seedDir)
{
var s = SeedLoader.LoadObject<ColosseumSeed>(Path.Combine(seedDir, "colosseum.json"));
if (s is null)
{
Console.WriteLine("[MyPageGlobalsImporter] No colosseum seed; skipping.");
return 0;
}
var existing = await context.Colosseums.FirstOrDefaultAsync(e => e.Id == 1);
var entry = existing ?? new ColosseumConfig { Id = 1 };
entry.ColosseumId = s.ColosseumId;
entry.ColosseumName = s.ColosseumName;
entry.CardPoolName = s.CardPoolName;
entry.DeckFormat = s.DeckFormat;
entry.StartTime = ImporterBase.ParseWireDateTime(s.StartTime);
entry.EndTime = ImporterBase.ParseWireDateTime(s.EndTime);
entry.NowRound = s.NowRound;
entry.IsDisplayTips = s.IsDisplayTips;
entry.TipsId = s.TipsId;
entry.IsColosseumPeriod = s.IsColosseumPeriod;
entry.IsRoundPeriod = s.IsRoundPeriod;
entry.IsNormalTwoPick = s.IsNormalTwoPick;
entry.IsSpecialMode = s.IsSpecialMode;
entry.IsAllCardEnabled = s.IsAllCardEnabled;
entry.SalesPeriodInfo = s.SalesPeriodInfo.ValueKind == JsonValueKind.Undefined
? "{}"
: JsonSerializer.Serialize(s.SalesPeriodInfo);
if (existing is null) context.Colosseums.Add(entry);
await context.SaveChangesAsync();
Console.WriteLine($"[MyPageGlobalsImporter] Colosseum: {(existing is null ? "+1" : "~1")}");
return 1;
}
public async Task<int> ImportSealedAsync(SVSimDbContext context, string seedDir)
{
var s = SeedLoader.LoadObject<SealedSeasonSeed>(Path.Combine(seedDir, "sealed-season.json"));

View File

@@ -1,24 +0,0 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace SVSim.Bootstrap.Models.Seed;
public sealed class ColosseumSeed
{
[JsonPropertyName("id")] public int Id { get; set; } = 1;
[JsonPropertyName("colosseum_id")] public string ColosseumId { get; set; } = "";
[JsonPropertyName("colosseum_name")] public string ColosseumName { get; set; } = "";
[JsonPropertyName("card_pool_name")] public string CardPoolName { get; set; } = "";
[JsonPropertyName("deck_format")] public string DeckFormat { get; set; } = "";
[JsonPropertyName("start_time")] public string StartTime { get; set; } = "";
[JsonPropertyName("end_time")] public string EndTime { get; set; } = "";
[JsonPropertyName("now_round")] public string NowRound { get; set; } = "";
[JsonPropertyName("is_display_tips")] public string IsDisplayTips { get; set; } = "";
[JsonPropertyName("tips_id")] public string TipsId { get; set; } = "";
[JsonPropertyName("is_colosseum_period")] public bool IsColosseumPeriod { get; set; }
[JsonPropertyName("is_round_period")] public bool IsRoundPeriod { get; set; }
[JsonPropertyName("is_normal_two_pick")] public string IsNormalTwoPick { get; set; } = "";
[JsonPropertyName("is_special_mode")] public string IsSpecialMode { get; set; } = "";
[JsonPropertyName("is_all_card_enabled")] public int IsAllCardEnabled { get; set; }
[JsonPropertyName("sales_period_info")] public JsonElement SalesPeriodInfo { get; set; }
}

View File

@@ -114,7 +114,6 @@ public static class Program
var mypage = new MyPageGlobalsImporter();
await mypage.ImportBannersAsync(context, opts.SeedDir);
await mypage.ImportColosseumAsync(context, opts.SeedDir);
await mypage.ImportSealedAsync(context, opts.SeedDir);
await mypage.ImportMasterPointRankingPeriodAsync(context, opts.SeedDir);
await mypage.ImportSpecialDeckFormatsAsync(context, opts.SeedDir);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SVSim.Database.Migrations
{
/// <inheritdoc />
public partial class DropColosseumsTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Colosseums");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Colosseums",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false),
CardPoolName = table.Column<string>(type: "text", nullable: false),
ColosseumId = table.Column<string>(type: "text", nullable: false),
ColosseumName = table.Column<string>(type: "text", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
DeckFormat = table.Column<string>(type: "text", nullable: false),
EndTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
IsAllCardEnabled = table.Column<int>(type: "integer", nullable: false),
IsColosseumPeriod = table.Column<bool>(type: "boolean", nullable: false),
IsDisplayTips = table.Column<string>(type: "text", nullable: false),
IsNormalTwoPick = table.Column<string>(type: "text", nullable: false),
IsRoundPeriod = table.Column<bool>(type: "boolean", nullable: false),
IsSpecialMode = table.Column<string>(type: "text", nullable: false),
NowRound = table.Column<string>(type: "text", nullable: false),
SalesPeriodInfo = table.Column<string>(type: "jsonb", nullable: false),
StartTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
TipsId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Colosseums", x => x.Id);
});
}
}
}

View File

@@ -1005,77 +1005,6 @@ namespace SVSim.Database.Migrations
b.ToTable("ColosseumAvatarDecks");
});
modelBuilder.Entity("SVSim.Database.Models.ColosseumConfig", b =>
{
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<string>("CardPoolName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ColosseumId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ColosseumName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DateUpdated")
.HasColumnType("timestamp with time zone");
b.Property<string>("DeckFormat")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("EndTime")
.HasColumnType("timestamp with time zone");
b.Property<int>("IsAllCardEnabled")
.HasColumnType("integer");
b.Property<bool>("IsColosseumPeriod")
.HasColumnType("boolean");
b.Property<string>("IsDisplayTips")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IsNormalTwoPick")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRoundPeriod")
.HasColumnType("boolean");
b.Property<string>("IsSpecialMode")
.IsRequired()
.HasColumnType("text");
b.Property<string>("NowRound")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SalesPeriodInfo")
.IsRequired()
.HasColumnType("jsonb");
b.Property<DateTime>("StartTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("TipsId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Colosseums");
});
modelBuilder.Entity("SVSim.Database.Models.ColosseumHofDeck", b =>
{
b.Property<long>("Id")

View File

@@ -1,42 +0,0 @@
using System.ComponentModel.DataAnnotations.Schema;
using SVSim.Database.Common;
namespace SVSim.Database.Models;
/// <summary>
/// Singleton row (Id=1) for the current Colosseum event from /mypage/index data.colosseum_info.
/// Time-bound — recapture per Colosseum cycle (every few weeks).
/// </summary>
public class ColosseumConfig : BaseEntity<int>
{
public string ColosseumId { get; set; } = string.Empty;
public string ColosseumName { get; set; } = string.Empty;
public string CardPoolName { get; set; } = string.Empty;
public string DeckFormat { get; set; } = string.Empty;
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public string NowRound { get; set; } = string.Empty;
public string IsDisplayTips { get; set; } = string.Empty;
public string TipsId { get; set; } = string.Empty;
public bool IsColosseumPeriod { get; set; }
public bool IsRoundPeriod { get; set; }
public string IsNormalTwoPick { get; set; } = string.Empty;
public string IsSpecialMode { get; set; } = string.Empty;
public int IsAllCardEnabled { get; set; }
[Column(TypeName = "jsonb")]
public string SalesPeriodInfo { get; set; } = "{}";
}

View File

@@ -72,9 +72,6 @@ public class GlobalsRepository : IGlobalsRepository
.ThenBy(e => e.Id)
.ToListAsync();
public Task<ColosseumConfig?> GetCurrentColosseum() =>
_dbContext.Colosseums.AsNoTracking().FirstOrDefaultAsync(e => e.Id == 1);
public Task<SealedConfig?> GetCurrentSealedSeason() =>
_dbContext.SealedSeasons.AsNoTracking().FirstOrDefaultAsync(e => e.Id == 1);

View File

@@ -22,7 +22,6 @@ public interface IGlobalsRepository
Task<List<DailyLoginBonusEntry>> GetDailyLoginBonus();
Task<List<BannerEntry>> GetBanners();
Task<IReadOnlyList<HomeDialogEntry>> GetActiveHomeDialogsAsync(DateTime nowUtc);
Task<ColosseumConfig?> GetCurrentColosseum();
Task<SealedConfig?> GetCurrentSealedSeason();
Task<MasterPointRankingPeriodEntry?> GetCurrentMasterPointPeriod();
Task<List<SpecialDeckFormatEntry>> GetActiveSpecialDeckFormats();

View File

@@ -63,7 +63,6 @@ public class SVSimDbContext : DbContext
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>();
public DbSet<SpecialDeckFormatEntry> SpecialDeckFormats => Set<SpecialDeckFormatEntry>();

View File

@@ -688,33 +688,8 @@ public class ArenaColosseumController : SVSimController
// --- helpers ---
private static ColosseumLobbyInfo BuildColosseumInfo(ColosseumSeasonConfig season)
{
if (!season.IsColosseumPeriod)
{
return new ColosseumLobbyInfo { IsColosseumPeriod = false };
}
return new ColosseumLobbyInfo
{
IsColosseumPeriod = true,
DeckFormat = (int)season.DeckFormat,
IsNormalTwoPick = season.IsNormalTwoPick ? "1" : "0",
ColosseumName = season.ColosseumName,
IsRoundPeriod = true,
IsSpecialMode = season.IsSpecialMode,
CardPoolName = string.IsNullOrEmpty(season.CardPoolName) ? null : season.CardPoolName,
NowRound = 1,
StartTime = FormatTime(season.EventStartTime),
EndTime = FormatTime(season.EventEndTime),
IsAllCardEnabled = season.IsAllCardEnabled ? 1 : 0,
SalesPeriodInfo = new SVSim.EmulatedEntrypoint.Models.Dtos.ColosseumSalesPeriodInfo
{
SalesPeriodTime = FormatTime(season.SalesPeriodEnd),
},
StrategyPickNum = season.StrategyPickNum > 0 ? season.StrategyPickNum : null,
};
}
private static ColosseumLobbyInfo BuildColosseumInfo(ColosseumSeasonConfig season) =>
ColosseumLobbyInfoBuilder.Build(season);
/// <summary>Builds the <c>colosseum_status</c> block. When the viewer has no run, every
/// property is null and global WhenWritingNull renders <c>{}</c> — the client

View File

@@ -9,6 +9,7 @@ using SVSim.Database.Services;
using SVSim.EmulatedEntrypoint.Constants;
using SVSim.EmulatedEntrypoint.Infrastructure;
using SVSim.EmulatedEntrypoint.Models.Dtos;
using SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
using SVSim.EmulatedEntrypoint.Models.Dtos.Common;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.MyPage;
@@ -61,7 +62,7 @@ public class MyPageController : SVSimController
// Hydrate all the globals slices in parallel-ish — they're independent reads.
var rotation = _config.Get<RotationConfig>();
var colosseum = await _globalsRepository.GetCurrentColosseum();
var colosseumSeason = _config.Get<ColosseumSeasonConfig>();
var sealedSeason = await _globalsRepository.GetCurrentSealedSeason();
var masterPointPeriod = await _globalsRepository.GetCurrentMasterPointPeriod();
var bannerEntries = await _globalsRepository.GetBanners();
@@ -93,7 +94,7 @@ public class MyPageController : SVSimController
ArenaInfo = await BuildArenaInfosAsync(viewer.Id),
IsArenaChallengePeriod = false, // TODO(mypage-stub): globals/ArenaSeason flag
IsAvailableColosseumFreeEntry = false, // TODO(mypage-stub): viewer + globals free-entry quota
ColosseumInfo = BuildColosseumInfo(colosseum),
ColosseumInfo = ColosseumLobbyInfoBuilder.Build(colosseumSeason),
SealedInfo = BuildSealedInfo(sealedSeason),
Banner = bannerEntries.Select(BuildBannerInfo).ToList(),
RoomTypeInSession = new RoomTypeInSession
@@ -237,37 +238,6 @@ public class MyPageController : SVSimController
};
}
private ColosseumInfo BuildColosseumInfo(ColosseumConfig? row)
{
if (row is null) return new ColosseumInfo();
ColosseumSalesPeriodInfo sales = new();
if (!string.IsNullOrEmpty(row.SalesPeriodInfo) && row.SalesPeriodInfo != "{}")
{
sales = JsonSerializer.Deserialize<ColosseumSalesPeriodInfo>(row.SalesPeriodInfo, JsonbReadOptions.Instance)
?? new ColosseumSalesPeriodInfo();
}
return new ColosseumInfo
{
ColosseumId = row.ColosseumId,
IsDisplayTips = row.IsDisplayTips,
TipsId = row.TipsId,
CardPoolName = row.CardPoolName,
IsColosseumPeriod = row.IsColosseumPeriod,
IsRoundPeriod = row.IsRoundPeriod,
DeckFormat = row.DeckFormat,
IsNormalTwoPick = row.IsNormalTwoPick,
IsSpecialMode = row.IsSpecialMode,
IsAllCardEnabled = row.IsAllCardEnabled,
StartTime = row.StartTime.ToString(WireDateFormat, CultureInfo.InvariantCulture),
ColosseumName = row.ColosseumName,
NowRound = row.NowRound,
EndTime = row.EndTime.ToString(WireDateFormat, CultureInfo.InvariantCulture),
SalesPeriodInfo = sales,
};
}
private SealedInfo BuildSealedInfo(SealedConfig? row)
{
if (row is null) return new SealedInfo();

View File

@@ -1,6 +1,5 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
@@ -10,10 +9,11 @@ namespace SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
/// <see cref="IsColosseumPeriod"/> is <c>false</c>, the client skips parsing every other
/// field — server still emits this minimal payload so the lobby renders cleanly.
/// <para>
/// Distinct from <see cref="SVSim.EmulatedEntrypoint.Models.Dtos.ColosseumInfo"/> (the
/// captured prod <c>/mypage/index</c> shape — stringly-typed and read-only). This is the
/// per-endpoint Colosseum-family shape. <c>/event_info</c> uses yet a third shape —
/// <see cref="ColosseumEventInfo"/>.
/// Also drives <c>/mypage/index data.colosseum_info</c> — the home-screen tab gating and
/// the per-endpoint lobby reads share one source of truth (the
/// <see cref="ColosseumSeasonConfig"/> POCO) projected via
/// <see cref="ColosseumLobbyInfoBuilder"/>. <c>/event_info</c> uses a different,
/// event-level shape — <see cref="ColosseumEventInfo"/>.
/// </para>
/// </summary>
[MessagePackObject]

View File

@@ -0,0 +1,48 @@
using System.Globalization;
using SVSim.Database.Models.Config;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
/// <summary>
/// Single source of truth for projecting <see cref="ColosseumSeasonConfig"/> onto the wire
/// <see cref="ColosseumLobbyInfo"/> block. Used by both <c>/arena_colosseum/{top,get_fee_info}</c>
/// AND <c>/mypage/index data.colosseum_info</c> — the home-screen tab and the lobby reads
/// must agree on the season state, so they go through one builder. When
/// <c>IsColosseumPeriod = false</c> the minimal "no event" payload is emitted; the client
/// gates every other field on that flag (<c>Wizard/ColosseumEntryInfoTask.cs:100</c>).
/// </summary>
public static class ColosseumLobbyInfoBuilder
{
private const string WireDateFormat = "yyyy-MM-dd HH:mm:ss";
public static ColosseumLobbyInfo Build(ColosseumSeasonConfig season)
{
if (!season.IsColosseumPeriod)
{
return new ColosseumLobbyInfo { IsColosseumPeriod = false };
}
return new ColosseumLobbyInfo
{
IsColosseumPeriod = true,
DeckFormat = (int)season.DeckFormat,
IsNormalTwoPick = season.IsNormalTwoPick ? "1" : "0",
ColosseumName = season.ColosseumName,
IsRoundPeriod = true,
IsSpecialMode = season.IsSpecialMode,
CardPoolName = string.IsNullOrEmpty(season.CardPoolName) ? null : season.CardPoolName,
NowRound = 1,
StartTime = FormatTime(season.EventStartTime),
EndTime = FormatTime(season.EventEndTime),
IsAllCardEnabled = season.IsAllCardEnabled ? 1 : 0,
SalesPeriodInfo = new ColosseumSalesPeriodInfo
{
SalesPeriodTime = FormatTime(season.SalesPeriodEnd),
},
StrategyPickNum = season.StrategyPickNum > 0 ? season.StrategyPickNum : null,
};
}
private static string FormatTime(DateTime t) =>
t == default ? "" : t.ToString(WireDateFormat, CultureInfo.InvariantCulture);
}

View File

@@ -0,0 +1,16 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
/// <summary>
/// Nested under <c>colosseum_info.sales_period_info</c>. Captured prod shape — single
/// <c>sales_period_time</c> field carrying the wall-clock end of the cup's sales window.
/// Format <c>"yyyy-MM-dd HH:mm:ss"</c> (PHP convention, not ISO).
/// </summary>
[MessagePackObject]
public sealed class ColosseumSalesPeriodInfo
{
[JsonPropertyName("sales_period_time")] [Key("sales_period_time")]
public string SalesPeriodTime { get; set; } = string.Empty;
}

View File

@@ -1,97 +0,0 @@
using MessagePack;
using System.Text.Json.Serialization;
namespace SVSim.EmulatedEntrypoint.Models.Dtos;
/// <summary>
/// colosseum_info on /mypage/index, consumed by ColosseumEntryInfoTask.SetColosseumInfo
/// (Wizard/ColosseumEntryInfoTask.cs:99). The outer object is read unconditionally, and
/// is_colosseum_period gates everything else. When a cup IS active, the client reads
/// many more sub-fields inside the gate (deck_format, now_round, start_time, end_time,
/// sales_period_info, etc.) — we now mirror the full prod shape so the gate-true branch
/// works once we have colosseum data seeded.
///
/// Prod-captured shape (15 fields):
/// <code>
/// {"colosseum_id":"165","is_display_tips":"0","tips_id":"0",
/// "card_pool_name":"Take Two (DragonbladeRivenbrandt)",
/// "is_colosseum_period":true,"is_round_period":true,"deck_format":"3",
/// "is_normal_two_pick":"1","is_special_mode":"10","is_all_card_enabled":0,
/// "start_time":"2026-05-21 06:00:00","colosseum_name":"Rivenbrandt Take Two Cup",
/// "now_round":"1","end_time":"2026-05-25 19:59:59",
/// "sales_period_info":{"sales_period_time":"2026-05-25 19:59:59"}}
/// </code>
/// </summary>
[MessagePackObject]
public class ColosseumInfo
{
[JsonPropertyName("colosseum_id")]
[Key("colosseum_id")]
public string ColosseumId { get; set; } = string.Empty;
/// <summary>Wire is "0"/"1" string. Client compares with == "1" (GetValueOrDefault-guarded).</summary>
[JsonPropertyName("is_display_tips")]
[Key("is_display_tips")]
public string IsDisplayTips { get; set; } = "0";
[JsonPropertyName("tips_id")]
[Key("tips_id")]
public string TipsId { get; set; } = "0";
[JsonPropertyName("card_pool_name")]
[Key("card_pool_name")]
public string CardPoolName { get; set; } = string.Empty;
[JsonPropertyName("is_colosseum_period")]
[Key("is_colosseum_period")]
public bool IsColosseumPeriod { get; set; }
[JsonPropertyName("is_round_period")]
[Key("is_round_period")]
public bool IsRoundPeriod { get; set; }
/// <summary>
/// Wire is a stringified int in prod (e.g. "3"). DB stores as string. Client calls
/// <c>jsonData["deck_format"].ToInt()</c> inside the IsColosseumPeriod gate.
/// </summary>
[JsonPropertyName("deck_format")]
[Key("deck_format")]
public string DeckFormat { get; set; } = "0";
/// <summary>Wire is "1"/"0" string. Client compares with == "1".</summary>
[JsonPropertyName("is_normal_two_pick")]
[Key("is_normal_two_pick")]
public string IsNormalTwoPick { get; set; } = "0";
/// <summary>Used as ColorCodeId (stringified int).</summary>
[JsonPropertyName("is_special_mode")]
[Key("is_special_mode")]
public string IsSpecialMode { get; set; } = "0";
[JsonPropertyName("is_all_card_enabled")]
[Key("is_all_card_enabled")]
public int IsAllCardEnabled { get; set; }
/// <summary>"yyyy-MM-dd HH:mm:ss" wire format.</summary>
[JsonPropertyName("start_time")]
[Key("start_time")]
public string StartTime { get; set; } = string.Empty;
[JsonPropertyName("colosseum_name")]
[Key("colosseum_name")]
public string ColosseumName { get; set; } = string.Empty;
/// <summary>Round number as string (e.g. "1"). Client casts to int.</summary>
[JsonPropertyName("now_round")]
[Key("now_round")]
public string NowRound { get; set; } = "0";
/// <summary>"yyyy-MM-dd HH:mm:ss" wire format.</summary>
[JsonPropertyName("end_time")]
[Key("end_time")]
public string EndTime { get; set; } = string.Empty;
[JsonPropertyName("sales_period_info")]
[Key("sales_period_info")]
public ColosseumSalesPeriodInfo SalesPeriodInfo { get; set; } = new();
}

View File

@@ -1,18 +0,0 @@
using MessagePack;
using System.Text.Json.Serialization;
namespace SVSim.EmulatedEntrypoint.Models.Dtos;
/// <summary>
/// Nested under /mypage/index data.colosseum_info.sales_period_info. Carries the wall-clock end of
/// the current cup's sales window. Captured from prod:
/// <c>"sales_period_info": { "sales_period_time": "2026-05-25 19:59:59" }</c>.
/// </summary>
[MessagePackObject]
public class ColosseumSalesPeriodInfo
{
/// <summary>Wire format is "yyyy-MM-dd HH:mm:ss" (prod's PHP convention, not ISO).</summary>
[JsonPropertyName("sales_period_time")]
[Key("sales_period_time")]
public string SalesPeriodTime { get; set; } = string.Empty;
}

View File

@@ -1,5 +1,6 @@
using MessagePack;
using SVSim.Database.Enums;
using SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
using System.Text.Json.Serialization;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses;
@@ -134,11 +135,13 @@ public class MyPageIndexResponse
/// <summary>
/// Required — ColosseumEntryInfoTask.SetColosseumInfo indexes this key
/// directly (Wizard/ColosseumEntryInfoTask.cs:102) and reads
/// is_colosseum_period without a guard.
/// is_colosseum_period without a guard. Built by
/// <see cref="ColosseumLobbyInfoBuilder"/> from <c>ColosseumSeasonConfig</c> —
/// shared with <c>/arena_colosseum/{top,get_fee_info}</c>.
/// </summary>
[JsonPropertyName("colosseum_info")]
[Key("colosseum_info")]
public ColosseumInfo ColosseumInfo { get; set; } = new();
public ColosseumLobbyInfo ColosseumInfo { get; set; } = new();
// ── Convention / offline event ─────────────────────────────────────────

View File

@@ -25,22 +25,6 @@ public class MyPageGlobalsImporterTests
Assert.That(count, Is.GreaterThan(0), "seed must contain banners");
}
[Test]
public async Task Imports_colosseum_singleton()
{
using var factory = new SVSimTestFactory();
using var scope = factory.Services.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SVSimDbContext>();
var importer = new MyPageGlobalsImporter();
await importer.ImportColosseumAsync(db, SeedDir);
var row = await db.Colosseums.FirstOrDefaultAsync(e => e.Id == 1);
Assert.That(row, Is.Not.Null);
Assert.That(row!.Id, Is.EqualTo(1));
Assert.That(row.ColosseumId, Is.Not.Empty);
}
[Test]
public async Task Imports_sealed_singleton()
{
@@ -145,14 +129,10 @@ public class MyPageGlobalsImporterTests
var db = scope.ServiceProvider.GetRequiredService<SVSimDbContext>();
var importer = new MyPageGlobalsImporter();
await importer.ImportColosseumAsync(db, SeedDir);
await importer.ImportSealedAsync(db, SeedDir);
await importer.ImportColosseumAsync(db, SeedDir);
await importer.ImportSealedAsync(db, SeedDir);
Assert.That(await db.Colosseums.CountAsync(), Is.EqualTo(1),
"Colosseum singleton must remain a single row on re-run");
Assert.That(await db.SealedSeasons.CountAsync(), Is.EqualTo(1),
"SealedSeason singleton must remain a single row on re-run");
}

View File

@@ -286,7 +286,6 @@ internal class SVSimTestFactory : WebApplicationFactory<Program>
var mypage = new MyPageGlobalsImporter();
await mypage.ImportBannersAsync(ctx, seedDir);
await mypage.ImportColosseumAsync(ctx, seedDir);
await mypage.ImportSealedAsync(ctx, seedDir);
await mypage.ImportMasterPointRankingPeriodAsync(ctx, seedDir);
await mypage.ImportSpecialDeckFormatsAsync(ctx, seedDir);

View File

@@ -151,17 +151,6 @@ public class GlobalsRepositoryTests
Assert.That(banners[0].Click, Is.EqualTo("account_transition_with_two"));
}
[Test]
public async Task GetCurrentColosseum_returns_singleton_with_name()
{
var (factory, repo) = await SetupAsync();
using var _ = factory;
var col = await repo.GetCurrentColosseum();
Assert.That(col, Is.Not.Null);
Assert.That(col!.ColosseumName, Is.EqualTo("Rivenbrandt Take Two Cup"));
Assert.That(col.ColosseumId, Is.EqualTo("165"));
}
[Test]
public async Task GetCurrentSealedSeason_returns_singleton_with_pack_info()
{