Add starter deck flow, admin force-logout + rename, shop flag

Auth chain:
- auth.proto: add needs_starter_deck to Login/Register/ValidateToken responses
- auth.proto: add RevokeAllSessions RPC
- AuthGrpcHandler: populate NeedsStarterDeck from Account.StarterDeckSelectedAt
- AuthGrpcHandler: track tokens in UserSessions Redis SET on create/logout
- AuthGrpcHandler: implement RevokeAllSessions (Redis + Postgres)
- IGatewayAuthValidator / GatewayAuthValidator: thread NeedsStarterDeck through tuples
- ConnectionLoop: include needsStarterDeck in auth ack payload

Client:
- Auth.gd: store needs_starter_deck from auth reply; clear on logout
- login_screen.gd: route to StarterDeckScreen when needs_starter_deck = true
- scenes/starter_deck/: new StarterDeckScreen (fetch decks → pick → confirm → InitScreen)

Admin panel:
- AccountDetail.razor: Force Logout All Sessions card (Redis + Postgres revoke)
- AccountDetail.razor: Change Display Name form with uniqueness check
- SOR.Admin: add StackExchange.Redis package + DI registration
- PrebuiltDeckEditor.razor: split into IsStarterDeck + IsAvailableInShop checkboxes
- PrebuiltDeck.cs: add IsAvailableInShop field
- Migration: AddPrebuiltDeckShopFlag

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-02-28 13:08:08 -05:00
co-authored by Claude Happy
parent fa8418387b
commit bdd6e59dfe
17 changed files with 1036 additions and 50 deletions
@@ -33,6 +33,12 @@ public sealed class PrebuiltDeck
/// </summary>
public bool IsStarterDeck { get; set; }
/// <summary>
/// When true this deck is purchasable in the Bazaar shop (in addition to or instead
/// of the starter-deck flow). A deck may have both flags set simultaneously.
/// </summary>
public bool IsAvailableInShop { get; set; }
/// <summary>Cross-schema: the ArchSpirit card included in this deck. Bare Guid.</summary>
public Guid? ArchSpiritCardDefinitionId { get; set; }
@@ -0,0 +1,481 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SOR.Database.Contexts;
#nullable disable
namespace SOR.Database.Migrations.Bazaar
{
[DbContext(typeof(BazaarDbContext))]
[Migration("20260228175431_AddPrebuiltDeckShopFlag")]
partial class AddPrebuiltDeckShopFlag
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("bazaar")
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SOR.Database.Entities.Bazaar.AuctionBid", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal>("Amount")
.HasColumnType("numeric(18,4)");
b.Property<Guid>("BidderAccountId")
.HasColumnType("uuid");
b.Property<string>("Currency")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsWinning")
.HasColumnType("boolean");
b.Property<Guid>("ListingId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("PlacedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("BidderAccountId");
b.HasIndex("ListingId", "Amount");
b.HasIndex("ListingId", "IsWinning");
b.ToTable("auction_bids", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.BazaarListing", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("Currency")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset?>("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsMasked")
.HasColumnType("boolean");
b.Property<DateTimeOffset>("ListedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("ListingType")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("PlayerCardId")
.HasColumnType("uuid");
b.Property<decimal>("Price")
.HasColumnType("numeric(18,4)");
b.Property<Guid>("SellerAccountId")
.HasColumnType("uuid");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SellerAccountId");
b.HasIndex("Status", "CardDefinitionId");
b.HasIndex("Status", "ExpiresAt");
b.ToTable("listings", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.BazaarTransaction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal>("Amount")
.HasColumnType("numeric(18,4)");
b.Property<Guid>("BuyerAccountId")
.HasColumnType("uuid");
b.Property<string>("Currency")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("ListingId")
.HasColumnType("uuid");
b.Property<Guid>("PlayerCardId")
.HasColumnType("uuid");
b.Property<Guid>("SellerAccountId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("TransactedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("BuyerAccountId");
b.HasIndex("ListingId");
b.HasIndex("SellerAccountId");
b.HasIndex("TransactedAt");
b.ToTable("transactions", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.BoosterPack", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("AvailableFrom")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("AvailableUntil")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("CardSetId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("ImageCdnUrl")
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<int>("OriginPointPrice")
.HasColumnType("integer");
b.Property<string>("SlotsJson")
.HasColumnType("jsonb");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("UsdPrice")
.HasColumnType("numeric(10,2)");
b.HasKey("Id");
b.HasIndex("IsActive");
b.HasIndex("AvailableFrom", "AvailableUntil");
b.ToTable("booster_packs", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.BoosterPackCardGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CardName")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsFoil")
.HasColumnType("boolean");
b.Property<Guid>("PlayerCardId")
.HasColumnType("uuid");
b.Property<Guid>("PurchaseRecordId")
.HasColumnType("uuid");
b.Property<string>("Rarity")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("PlayerCardId");
b.HasIndex("PurchaseRecordId");
b.ToTable("booster_pack_card_grants", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.Cosmetic", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AssetCdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CosmeticType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<int>("OriginPointPrice")
.HasColumnType("integer");
b.Property<string>("PreviewImageCdnUrl")
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("UsdPrice")
.HasColumnType("numeric(10,2)");
b.HasKey("Id");
b.HasIndex("CardDefinitionId");
b.HasIndex("CosmeticType", "IsActive");
b.ToTable("cosmetics", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.PrebuiltDeck", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid?>("ArchSpiritCardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("ArchSpiritName")
.HasColumnType("text");
b.Property<DateTimeOffset?>("AvailableFrom")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("AvailableUntil")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("ImageCdnUrl")
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsAvailableInShop")
.HasColumnType("boolean");
b.Property<bool>("IsStarterDeck")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<int>("OriginPointPrice")
.HasColumnType("integer");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal?>("UsdPrice")
.HasColumnType("numeric(10,2)");
b.HasKey("Id");
b.HasIndex("IsActive");
b.HasIndex("IsStarterDeck");
b.ToTable("prebuilt_decks", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.PrebuiltDeckCard", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CardName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("PrebuiltDeckId")
.HasColumnType("uuid");
b.Property<int>("Quantity")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("PrebuiltDeckId", "CardDefinitionId")
.IsUnique();
b.ToTable("prebuilt_deck_cards", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.PurchaseRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AccountId")
.HasColumnType("uuid");
b.Property<int>("OriginPointsSpent")
.HasColumnType("integer");
b.Property<Guid?>("ProductId")
.HasColumnType("uuid");
b.Property<string>("ProductType")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("PurchasedAt")
.HasColumnType("timestamp with time zone");
b.Property<int>("QuantityGranted")
.HasColumnType("integer");
b.Property<decimal?>("UsdSpent")
.HasColumnType("numeric(10,2)");
b.HasKey("Id");
b.HasIndex("AccountId", "PurchasedAt");
b.HasIndex("ProductType", "PurchasedAt");
b.ToTable("purchase_records", "bazaar");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.AuctionBid", b =>
{
b.HasOne("SOR.Database.Entities.Bazaar.BazaarListing", "Listing")
.WithMany()
.HasForeignKey("ListingId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Listing");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.BazaarTransaction", b =>
{
b.HasOne("SOR.Database.Entities.Bazaar.BazaarListing", "Listing")
.WithMany("Transactions")
.HasForeignKey("ListingId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Listing");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.BoosterPackCardGrant", b =>
{
b.HasOne("SOR.Database.Entities.Bazaar.PurchaseRecord", "PurchaseRecord")
.WithMany("CardGrants")
.HasForeignKey("PurchaseRecordId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PurchaseRecord");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.PrebuiltDeckCard", b =>
{
b.HasOne("SOR.Database.Entities.Bazaar.PrebuiltDeck", "PrebuiltDeck")
.WithMany("Cards")
.HasForeignKey("PrebuiltDeckId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PrebuiltDeck");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.BazaarListing", b =>
{
b.Navigation("Transactions");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.PrebuiltDeck", b =>
{
b.Navigation("Cards");
});
modelBuilder.Entity("SOR.Database.Entities.Bazaar.PurchaseRecord", b =>
{
b.Navigation("CardGrants");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Bazaar
{
/// <inheritdoc />
public partial class AddPrebuiltDeckShopFlag : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsAvailableInShop",
schema: "bazaar",
table: "prebuilt_decks",
type: "boolean",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsAvailableInShop",
schema: "bazaar",
table: "prebuilt_decks");
}
}
}
@@ -320,6 +320,9 @@ namespace SOR.Database.Migrations.Bazaar
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsAvailableInShop")
.HasColumnType("boolean");
b.Property<bool>("IsStarterDeck")
.HasColumnType("boolean");