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

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>();