Add collection service — deck management + card inventory

SOR.Collection project (new):
- 8 message handlers over WebSocket: get_cards, get_decks, get_deck,
  create_deck, rename_deck, delete_deck, add_card, remove_card
- Deck construction rules (DeckRules.cs): min 20 / max 40 cards,
  max 4 copies per definition, max 20 decks per player
- add_card validates ownership (player must own enough physical copies),
  copy limit, deck size limit, and rejects ArchSpirits from the card list
- RefreshValidityAsync recalculates Deck.IsValid after every mutation
- Cross-context lookups (CollectionDbContext + CatalogDbContext) with
  batch queries — never N+1

Admin portal pages (new):
- /collection — overview stats (total cards, total decks, valid decks,
  unique players) + account ID lookup
- /collection/player/{accountId} — full player collection viewer:
  paginated card grid with name/type/affinity/rarity/foil/serial filters,
  deck list with expanded card tables, Grant Card modal (search + foil
  toggle, grants 1–100 copies), revoke individual card instances

Wiring:
- SOR.slnx + SOR.Host.csproj: added SOR.Collection project reference
- Program.cs: uncommented collection service registration
- NavMenu: added Collection item

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-25 12:28:17 -05:00
co-authored by Claude Happy
parent 925b2b1b3b
commit 0198aec9e5
19 changed files with 1594 additions and 3 deletions
+1
View File
@@ -3,6 +3,7 @@
<Project Path="src/SOR.Admin/SOR.Admin.csproj" />
<Project Path="src/SOR.Auth/SOR.Auth.csproj" />
<Project Path="src/SOR.Cdn/SOR.Cdn.csproj" />
<Project Path="src/SOR.Collection/SOR.Collection.csproj" />
<Project Path="src/SOR.Database/SOR.Database.csproj" />
<Project Path="src/SOR.Gateway/SOR.Gateway.csproj" />
<Project Path="src/SOR.Host/SOR.Host.csproj" />