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,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;
}