Add starter deck system and AI art tracker

- PlayerCard.IsTradeable (default true; false for starter deck grants)
- PrebuiltDeck.IsStarterDeck flag + index
- Account.StarterDeckSelectedAt one-time onboarding gate
- CardAsset.IsAiGenerated + CardAnimationBinding.IsAiGenerated
- Handlers: CollectionGetStarterDecks, CollectionSelectStarterDeck
- CollectionGetCards passes IsTradeable through to PlayerCardDto
- Admin: PrebuiltDeckEditor Starter checkbox, CardEditor AI Generated
  checkboxes on assets and animation rows
- Admin: /content/ai-assets AI Art Tracker page + NavMenu entry
- 4 EF migrations applied to pg-forge-01

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 14:46:00 -05:00
co-authored by Claude Happy
parent 3e4a07d4b5
commit 2cac55cbd9
28 changed files with 1796 additions and 4 deletions
@@ -53,6 +53,11 @@
</li> </li>
</ul> </ul>
</li> </li>
<li class="nav-item">
<NavLink class="nav-link text-white" href="/content/ai-assets" Match="NavLinkMatch.All">
<i class="bi bi-robot me-2"></i>AI Art Tracker
</NavLink>
</li>
<li class="nav-item"> <li class="nav-item">
<NavLink class="nav-link text-white" href="/feature-flags"> <NavLink class="nav-link text-white" href="/feature-flags">
<i class="bi bi-toggles me-2"></i>Feature Flags <i class="bi bi-toggles me-2"></i>Feature Flags
@@ -67,11 +67,17 @@ else
class="form-control" placeholder="—" /> class="form-control" placeholder="—" />
</div> </div>
</div> </div>
<div class="col-md-4 d-flex align-items-end"> <div class="col-md-4 d-flex align-items-end gap-4">
<div class="form-check"> <div class="form-check">
<input @bind="_deck.IsActive" type="checkbox" class="form-check-input" id="chkActive" /> <input @bind="_deck.IsActive" type="checkbox" class="form-check-input" id="chkActive" />
<label class="form-check-label fw-medium" for="chkActive">Active</label> <label class="form-check-label fw-medium" for="chkActive">Active</label>
</div> </div>
<div class="form-check">
<input @bind="_deck.IsStarterDeck" type="checkbox" class="form-check-input" id="chkStarter" />
<label class="form-check-label fw-medium text-warning" for="chkStarter">
<i class="bi bi-star-fill me-1"></i>Starter
</label>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -282,6 +282,14 @@ else
</div> </div>
<input @bind="asset.MimeType" class="form-control form-control-sm mb-2" <input @bind="asset.MimeType" class="form-control form-control-sm mb-2"
placeholder="MIME type (e.g. image/webp, model/gltf-binary)" /> placeholder="MIME type (e.g. image/webp, model/gltf-binary)" />
<div class="form-check mb-2">
<input @bind="asset.IsAiGenerated" type="checkbox"
class="form-check-input" id="ai_asset_@asset.Id" />
<label class="form-check-label small text-warning"
for="ai_asset_@asset.Id">
<i class="bi bi-robot me-1"></i>AI Generated
</label>
</div>
<label class="btn btn-sm btn-outline-primary @(_uploading.Contains(capturedAsset.Id) ? "disabled" : "")"> <label class="btn btn-sm btn-outline-primary @(_uploading.Contains(capturedAsset.Id) ? "disabled" : "")">
@if (_uploading.Contains(capturedAsset.Id)) @if (_uploading.Contains(capturedAsset.Id))
{ {
@@ -314,7 +322,7 @@ else
<h6 class="text-muted mb-3">Animation Bindings</h6> <h6 class="text-muted mb-3">Animation Bindings</h6>
<table class="table table-sm"> <table class="table table-sm">
<thead><tr><th>Action</th><th>CDN URL</th><th>Upload</th><th></th></tr></thead> <thead><tr><th>Action</th><th>CDN URL</th><th>AI</th><th>Upload</th><th></th></tr></thead>
<tbody> <tbody>
@foreach (var anim in _card.AnimationBindings) @foreach (var anim in _card.AnimationBindings)
{ {
@@ -328,6 +336,13 @@ else
<input @bind="anim.AnimationCdnUrl" class="form-control form-control-sm" <input @bind="anim.AnimationCdnUrl" class="form-control form-control-sm"
placeholder="https://cdn.sor.gg/…" /> placeholder="https://cdn.sor.gg/…" />
</td> </td>
<td style="width:50px" class="text-center align-middle">
<div class="form-check d-flex justify-content-center">
<input @bind="anim.IsAiGenerated" type="checkbox"
class="form-check-input" title="AI Generated"
id="ai_anim_@anim.Id" />
</div>
</td>
<td style="width:110px"> <td style="width:110px">
<label class="btn btn-sm btn-outline-primary @(_uploading.Contains(capturedAnim.Id) ? "disabled" : "")"> <label class="btn btn-sm btn-outline-primary @(_uploading.Contains(capturedAnim.Id) ? "disabled" : "")">
@if (_uploading.Contains(capturedAnim.Id)) @if (_uploading.Contains(capturedAnim.Id))
@@ -0,0 +1,216 @@
@page "/content/ai-assets"
@attribute [Authorize(Roles = "Admin,SuperAdmin")]
@using Microsoft.EntityFrameworkCore
@using SOR.Database.Contexts
@using SOR.Database.Entities.Catalog
@inject CatalogDbContext Db
<PageTitle>AI Art Tracker – SOR Admin</PageTitle>
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="mb-0">AI Art Tracker</h1>
<button class="btn btn-outline-secondary btn-sm" @onclick="LoadAsync">
<i class="bi bi-arrow-clockwise me-1"></i>Refresh
</button>
</div>
<p class="text-muted">
All assets and animations flagged as AI-generated across the card catalog.
</p>
@if (_loading)
{
<p class="text-muted">Loading…</p>
}
else
{
<!-- Static Assets -->
<div class="card shadow-sm mb-4">
<div class="card-header fw-medium d-flex justify-content-between align-items-center">
<span>
<i class="bi bi-image me-2"></i>Static Assets
<span class="badge bg-warning text-dark ms-2">@_assets.Count AI-generated</span>
</span>
</div>
<div class="card-body p-0">
@if (_assets.Count == 0)
{
<p class="text-muted p-3 mb-0">No AI-generated static assets.</p>
}
else
{
<table class="table table-sm table-hover mb-0">
<thead class="table-light">
<tr>
<th>Card</th>
<th>Type</th>
<th>Asset Type</th>
<th>MIME</th>
<th>CDN URL</th>
<th>Created</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var a in _assets)
{
<tr>
<td class="fw-medium">@a.CardName</td>
<td><span class="badge bg-secondary">@a.CardType</span></td>
<td><span class="badge bg-primary">@a.AssetType</span></td>
<td class="text-muted small">@a.MimeType</td>
<td>
@if (!string.IsNullOrEmpty(a.CdnUrl))
{
<a href="@a.CdnUrl" target="_blank"
class="text-decoration-none small font-monospace">
@TruncateUrl(a.CdnUrl)
<i class="bi bi-box-arrow-up-right ms-1"></i>
</a>
}
else
{
<span class="text-muted">—</span>
}
</td>
<td class="text-muted small">@a.CreatedAt.ToString("yyyy-MM-dd")</td>
<td>
<a href="/cards/@a.CardId" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-pencil"></i>
</a>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
<!-- Animation Bindings -->
<div class="card shadow-sm">
<div class="card-header fw-medium d-flex justify-content-between align-items-center">
<span>
<i class="bi bi-camera-video me-2"></i>Animation Bindings
<span class="badge bg-warning text-dark ms-2">@_animations.Count AI-generated</span>
</span>
</div>
<div class="card-body p-0">
@if (_animations.Count == 0)
{
<p class="text-muted p-3 mb-0">No AI-generated animation bindings.</p>
}
else
{
<table class="table table-sm table-hover mb-0">
<thead class="table-light">
<tr>
<th>Card</th>
<th>Type</th>
<th>Action</th>
<th>CDN URL</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var a in _animations)
{
<tr>
<td class="fw-medium">@a.CardName</td>
<td><span class="badge bg-secondary">@a.CardType</span></td>
<td class="font-monospace small">@a.ActionName</td>
<td>
@if (!string.IsNullOrEmpty(a.CdnUrl))
{
<a href="@a.CdnUrl" target="_blank"
class="text-decoration-none small font-monospace">
@TruncateUrl(a.CdnUrl)
<i class="bi bi-box-arrow-up-right ms-1"></i>
</a>
}
else
{
<span class="text-muted">—</span>
}
</td>
<td>
<a href="/cards/@a.CardId" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-pencil"></i>
</a>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
}
@code {
private bool _loading = true;
private record AssetRow(
Guid CardId,
string CardName,
string CardType,
string AssetType,
string? MimeType,
string? CdnUrl,
DateTimeOffset CreatedAt);
private record AnimationRow(
Guid CardId,
string CardName,
string CardType,
string? ActionName,
string? CdnUrl);
private List<AssetRow> _assets = new();
private List<AnimationRow> _animations = new();
protected override async Task OnInitializedAsync() => await LoadAsync();
private async Task LoadAsync()
{
_loading = true;
_assets = await Db.CardAssets
.Where(a => a.IsAiGenerated)
.Include(a => a.CardDefinition)
.OrderBy(a => a.CardDefinition.Name)
.ThenBy(a => a.AssetType)
.Select(a => new AssetRow(
a.CardDefinitionId,
a.CardDefinition.Name,
a.CardDefinition.CardType.ToString(),
a.AssetType.ToString(),
a.MimeType,
a.CdnUrl,
a.CreatedAt))
.ToListAsync();
_animations = await Db.AnimationBindings
.Where(a => a.IsAiGenerated)
.Include(a => a.CardDefinition)
.OrderBy(a => a.CardDefinition.Name)
.ThenBy(a => a.ActionName)
.Select(a => new AnimationRow(
a.CardDefinitionId,
a.CardDefinition.Name,
a.CardDefinition.CardType.ToString(),
a.ActionName,
a.AnimationCdnUrl))
.ToListAsync();
_loading = false;
}
private static string TruncateUrl(string url)
{
const int max = 40;
if (url.Length <= max) return url;
var last = url.LastIndexOf('/');
return last > 0 ? "…/" + url[(last + 1)..] : "…" + url[^max..];
}
}
@@ -51,6 +51,17 @@ public sealed record RemoveCardRequest(Guid DeckId, Guid CardDefinitionId, int?
/// </summary> /// </summary>
public sealed record CloneDeckRequest(Guid DeckId, string? Name = null); public sealed record CloneDeckRequest(Guid DeckId, string? Name = null);
/// <summary>Returns all active starter decks available for new-account selection.</summary>
public sealed record GetStarterDecksRequest; // identity from connection
/// <summary>
/// Selects and binds a starter deck to the account.
/// Can only be called once per account (guarded by Account.StarterDeckSelectedAt).
/// Grants all cards from the deck as non-tradeable PlayerCards and creates a
/// ready-to-play Deck in the player's collection.
/// </summary>
public sealed record SelectStarterDeckRequest(Guid StarterDeckId);
// ── Response / DTO types (server → client) ──────────────────────────────────── // ── Response / DTO types (server → client) ────────────────────────────────────
public sealed record GetCardsResponse( public sealed record GetCardsResponse(
@@ -69,7 +80,8 @@ public sealed record PlayerCardDto(
bool IsFoil, bool IsFoil,
int? SerialNumber, int? SerialNumber,
DateTimeOffset AcquiredAt, DateTimeOffset AcquiredAt,
string? ArtUrl); string? ArtUrl,
bool IsTradeable = true);
public sealed record GetDecksResponse(IEnumerable<DeckSummaryDto> Decks); public sealed record GetDecksResponse(IEnumerable<DeckSummaryDto> Decks);
@@ -109,3 +121,16 @@ public sealed record DeckCardDto(
int OwnedCount); int OwnedCount);
public sealed record DeckMutationResponse(DeckSummaryDto Deck); public sealed record DeckMutationResponse(DeckSummaryDto Deck);
public sealed record GetStarterDecksResponse(IEnumerable<StarterDeckDto> Decks);
public sealed record StarterDeckDto(
Guid Id,
string Name,
string? Description,
Guid? ArchSpiritCardDefinitionId,
string? ArchSpiritName,
string? ImageCdnUrl,
int TotalCards);
public sealed record SelectStarterDeckResponse(DeckSummaryDto Deck);
@@ -93,7 +93,8 @@ internal sealed class CollectionGetCardsHandler : CollectionHandlerBase, IMessag
IsFoil: pc.IsFoil, IsFoil: pc.IsFoil,
SerialNumber: pc.SerialNumber, SerialNumber: pc.SerialNumber,
AcquiredAt: pc.AcquiredAt, AcquiredAt: pc.AcquiredAt,
ArtUrl: GetArtUrl(def)); ArtUrl: GetArtUrl(def),
IsTradeable: pc.IsTradeable);
}); });
return ServerMessage.Reply( return ServerMessage.Reply(
@@ -0,0 +1,43 @@
namespace SOR.Collection.Handlers;
using Microsoft.EntityFrameworkCore;
using SOR.Database.Contexts;
using SOR.Networking.Abstractions.Messaging;
using SOR.Networking.Abstractions.Transport;
using SOR.Shared.Networking;
/// <summary>
/// collection.get_starter_decks — returns all active starter decks available
/// for a new player to choose from during onboarding.
/// </summary>
internal sealed class CollectionGetStarterDecksHandler : CollectionHandlerBase, IMessageHandler
{
private readonly BazaarDbContext _bazaarDb;
public CollectionGetStarterDecksHandler(BazaarDbContext bazaarDb)
=> _bazaarDb = bazaarDb;
public string MessageType => "collection.get_starter_decks";
public async Task<IServerMessage?> HandleAsync(
IClientMessage message,
AuthenticatedConnection connection,
CancellationToken cancellationToken)
{
var decks = await _bazaarDb.PrebuiltDecks
.Where(d => d.IsStarterDeck && d.IsActive)
.OrderBy(d => d.Name)
.Select(d => new StarterDeckDto(
d.Id,
d.Name,
d.Description,
d.ArchSpiritCardDefinitionId,
d.ArchSpiritName,
d.ImageCdnUrl,
d.Cards.Sum(c => c.Quantity)))
.ToListAsync(cancellationToken);
return ServerMessage.Reply("collection.get_starter_decks.ack", message.Seq,
new GetStarterDecksResponse(decks));
}
}
@@ -0,0 +1,160 @@
namespace SOR.Collection.Handlers;
using Microsoft.EntityFrameworkCore;
using SOR.Database.Contexts;
using SOR.Database.Entities.Collection;
using SOR.Database.Entities.Identity;
using SOR.Networking.Abstractions.Messaging;
using SOR.Networking.Abstractions.Transport;
using SOR.Shared.Networking;
/// <summary>
/// collection.select_starter_deck — binds a starter deck to the player's account.
///
/// Can be called exactly once per account (guarded by Account.StarterDeckSelectedAt).
///
/// On success:
/// - All cards from the PrebuiltDeck (including the ArchSpirit) are granted as
/// PlayerCards with IsTradeable = false.
/// - A Deck is created in the player's collection using those cards.
/// - Account.StarterDeckSelectedAt is stamped.
/// </summary>
internal sealed class CollectionSelectStarterDeckHandler : CollectionHandlerBase, IMessageHandler
{
private readonly IMessageSerializer _serializer;
private readonly CollectionDbContext _collectionDb;
private readonly CatalogDbContext _catalogDb;
private readonly BazaarDbContext _bazaarDb;
private readonly SorIdentityDbContext _identityDb;
public CollectionSelectStarterDeckHandler(
IMessageSerializer serializer,
CollectionDbContext collectionDb,
CatalogDbContext catalogDb,
BazaarDbContext bazaarDb,
SorIdentityDbContext identityDb)
{
_serializer = serializer;
_collectionDb = collectionDb;
_catalogDb = catalogDb;
_bazaarDb = bazaarDb;
_identityDb = identityDb;
}
public string MessageType => "collection.select_starter_deck";
public async Task<IServerMessage?> HandleAsync(
IClientMessage message,
AuthenticatedConnection connection,
CancellationToken cancellationToken)
{
var req = _serializer.DeserializePayload<SelectStarterDeckRequest>(message.Payload);
var accountId = Guid.Parse(connection.UserId);
// ── Guard: one-time selection ─────────────────────────────────────────
var account = await _identityDb.Set<Account>()
.FirstOrDefaultAsync(a => a.Id == accountId, cancellationToken);
if (account == null)
return ServerMessage.Error(message.Seq, "ACCOUNT_NOT_FOUND", "Account not found.");
if (account.StarterDeckSelectedAt.HasValue)
return ServerMessage.Error(message.Seq, "ALREADY_SELECTED",
"You have already selected a starter deck.");
// ── Load the starter deck ─────────────────────────────────────────────
var starterDeck = await _bazaarDb.PrebuiltDecks
.Include(d => d.Cards)
.FirstOrDefaultAsync(
d => d.Id == req.StarterDeckId && d.IsStarterDeck && d.IsActive,
cancellationToken);
if (starterDeck == null)
return ServerMessage.Error(message.Seq, "DECK_NOT_FOUND",
"Starter deck not found or is no longer available.");
if (!starterDeck.ArchSpiritCardDefinitionId.HasValue)
return ServerMessage.Error(message.Seq, "INVALID_DECK",
"Starter deck has no ArchSpirit configured.");
var now = DateTimeOffset.UtcNow;
// ── Grant PlayerCards (untradeable) ───────────────────────────────────
// One PlayerCard row per copy of each card in the prebuilt deck.
foreach (var deckCard in starterDeck.Cards)
{
for (int i = 0; i < deckCard.Quantity; i++)
{
_collectionDb.PlayerCards.Add(new PlayerCard
{
AccountId = accountId,
CardDefinitionId = deckCard.CardDefinitionId,
AcquiredAt = now,
IsTradeable = false,
});
}
}
// Grant the ArchSpirit.
_collectionDb.PlayerCards.Add(new PlayerCard
{
AccountId = accountId,
CardDefinitionId = starterDeck.ArchSpiritCardDefinitionId.Value,
AcquiredAt = now,
IsTradeable = false,
});
await _collectionDb.SaveChangesAsync(cancellationToken);
// ── Create the player's starter deck ──────────────────────────────────
var deck = new Deck
{
AccountId = accountId,
Name = starterDeck.Name,
ArchSpiritCardDefinitionId = starterDeck.ArchSpiritCardDefinitionId.Value,
IsValid = false, // set by RefreshValidityAsync below
CreatedAt = now,
UpdatedAt = now,
};
_collectionDb.Decks.Add(deck);
await _collectionDb.SaveChangesAsync(cancellationToken);
foreach (var deckCard in starterDeck.Cards)
{
_collectionDb.DeckCards.Add(new DeckCard
{
DeckId = deck.Id,
CardDefinitionId = deckCard.CardDefinitionId,
Quantity = deckCard.Quantity,
});
}
await _collectionDb.SaveChangesAsync(cancellationToken);
// ── Validate ──────────────────────────────────────────────────────────
var warnings = await RefreshValidityAsync(_collectionDb, _catalogDb, deck, cancellationToken);
// ── Stamp account ─────────────────────────────────────────────────────
account.StarterDeckSelectedAt = now;
await _identityDb.SaveChangesAsync(cancellationToken);
// ── Build response ────────────────────────────────────────────────────
var archName = await _catalogDb.CardDefinitions
.Where(cd => cd.Id == deck.ArchSpiritCardDefinitionId)
.Select(cd => cd.Name)
.FirstOrDefaultAsync(cancellationToken);
var summary = new DeckSummaryDto(
Id: deck.Id,
Name: deck.Name,
ArchSpiritCardDefinitionId: deck.ArchSpiritCardDefinitionId,
ArchSpiritName: archName,
CardCount: starterDeck.Cards.Sum(c => c.Quantity),
IsValid: deck.IsValid,
CreatedAt: deck.CreatedAt,
UpdatedAt: deck.UpdatedAt,
ValidationWarnings: warnings.Length > 0 ? warnings : null);
return ServerMessage.Reply("collection.select_starter_deck.ack", message.Seq,
new SelectStarterDeckResponse(summary));
}
}
@@ -19,6 +19,8 @@ public static class ServiceRegistration
// Database contexts the collection service needs. // Database contexts the collection service needs.
services.AddCollectionDatabase(configuration); services.AddCollectionDatabase(configuration);
services.AddCatalogDatabase(configuration); services.AddCatalogDatabase(configuration);
services.AddBazaarDatabase(configuration); // needed by starter deck handlers
services.AddIdentityDatabase(configuration); // needed by starter deck handlers
// Message handlers — one per message type, Transient lifetime. // Message handlers — one per message type, Transient lifetime.
// MessageDispatcher collects all IMessageHandler registrations at startup. // MessageDispatcher collects all IMessageHandler registrations at startup.
@@ -31,6 +33,8 @@ public static class ServiceRegistration
services.AddTransient<IMessageHandler, CollectionAddCardHandler>(); services.AddTransient<IMessageHandler, CollectionAddCardHandler>();
services.AddTransient<IMessageHandler, CollectionRemoveCardHandler>(); services.AddTransient<IMessageHandler, CollectionRemoveCardHandler>();
services.AddTransient<IMessageHandler, CollectionCloneDeckHandler>(); services.AddTransient<IMessageHandler, CollectionCloneDeckHandler>();
services.AddTransient<IMessageHandler, CollectionGetStarterDecksHandler>();
services.AddTransient<IMessageHandler, CollectionSelectStarterDeckHandler>();
return services; return services;
} }
@@ -79,6 +79,7 @@ public sealed class BazaarDbContext : DbContext
e.Property(d => d.Name).HasMaxLength(200); e.Property(d => d.Name).HasMaxLength(200);
e.Property(d => d.UsdPrice).HasColumnType("numeric(10,2)"); e.Property(d => d.UsdPrice).HasColumnType("numeric(10,2)");
e.HasIndex(d => d.IsActive); e.HasIndex(d => d.IsActive);
e.HasIndex(d => d.IsStarterDeck);
e.HasMany(d => d.Cards) e.HasMany(d => d.Cards)
.WithOne(c => c.PrebuiltDeck) .WithOne(c => c.PrebuiltDeck)
.HasForeignKey(c => c.PrebuiltDeckId) .HasForeignKey(c => c.PrebuiltDeckId)
@@ -31,6 +31,8 @@ public sealed class CollectionDbContext : DbContext
{ {
e.ToTable("player_cards"); e.ToTable("player_cards");
e.HasKey(c => c.Id); e.HasKey(c => c.Id);
// Existing rows default to tradeable after migration.
e.Property(c => c.IsTradeable).HasDefaultValue(true);
e.HasIndex(c => c.AccountId); e.HasIndex(c => c.AccountId);
e.HasIndex(c => new { c.AccountId, c.CardDefinitionId }); e.HasIndex(c => new { c.AccountId, c.CardDefinitionId });
}); });
@@ -27,6 +27,12 @@ public sealed class PrebuiltDeck
public bool IsActive { get; set; } public bool IsActive { get; set; }
/// <summary>
/// When true this deck appears in the new-account starter deck selection screen.
/// Cards granted from a starter deck are marked IsTradeable = false.
/// </summary>
public bool IsStarterDeck { get; set; }
/// <summary>Cross-schema: the ArchSpirit card included in this deck. Bare Guid.</summary> /// <summary>Cross-schema: the ArchSpirit card included in this deck. Bare Guid.</summary>
public Guid? ArchSpiritCardDefinitionId { get; set; } public Guid? ArchSpiritCardDefinitionId { get; set; }
@@ -26,5 +26,11 @@ public sealed class CardAnimationBinding
/// <summary>CDN URL to the animation file (glTF animation, Spine, etc.).</summary> /// <summary>CDN URL to the animation file (glTF animation, Spine, etc.).</summary>
public string AnimationCdnUrl { get; set; } = string.Empty; public string AnimationCdnUrl { get; set; } = string.Empty;
/// <summary>
/// True if this animation was generated by an AI tool.
/// Surfaced in the AI art tracker report in the admin portal.
/// </summary>
public bool IsAiGenerated { get; set; }
public CardDefinition CardDefinition { get; set; } = null!; public CardDefinition CardDefinition { get; set; } = null!;
} }
@@ -19,6 +19,12 @@ public sealed class CardAsset
/// <summary>MIME type of the asset, e.g. image/webp, model/gltf-binary.</summary> /// <summary>MIME type of the asset, e.g. image/webp, model/gltf-binary.</summary>
public string? MimeType { get; set; } public string? MimeType { get; set; }
/// <summary>
/// True if this asset was generated by an AI tool (Midjourney, DALL-E, Stable Diffusion, etc.).
/// Surfaced in the AI art tracker report in the admin portal.
/// </summary>
public bool IsAiGenerated { get; set; }
public DateTimeOffset CreatedAt { get; set; } public DateTimeOffset CreatedAt { get; set; }
public CardDefinition CardDefinition { get; set; } = null!; public CardDefinition CardDefinition { get; set; } = null!;
@@ -26,4 +26,10 @@ public sealed class PlayerCard
/// <summary>Sequential print number for limited/numbered cards. Null = unlimited.</summary> /// <summary>Sequential print number for limited/numbered cards. Null = unlimited.</summary>
public int? SerialNumber { get; set; } public int? SerialNumber { get; set; }
/// <summary>
/// False for cards granted from a starter deck — they cannot be listed on the
/// bazaar. All other cards (booster packs, P2P trades, grants) default to true.
/// </summary>
public bool IsTradeable { get; set; } = true;
} }
@@ -25,4 +25,10 @@ public sealed class Account : IdentityUser<Guid>
/// <summary>UTC time of the most recent successful login.</summary> /// <summary>UTC time of the most recent successful login.</summary>
public DateTimeOffset? LastLoginAt { get; set; } public DateTimeOffset? LastLoginAt { get; set; }
/// <summary>
/// Set when the player completes the starter deck selection during onboarding.
/// Null means they have not yet chosen their starter deck.
/// </summary>
public DateTimeOffset? StarterDeckSelectedAt { get; set; }
} }
@@ -0,0 +1,288 @@
// <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("20260225190933_AddIsStarterDeck")]
partial class AddIsStarterDeck
{
/// <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.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<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.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>("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.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.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");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Bazaar
{
/// <inheritdoc />
public partial class AddIsStarterDeck : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsStarterDeck",
schema: "bazaar",
table: "prebuilt_decks",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.CreateIndex(
name: "IX_prebuilt_decks_IsStarterDeck",
schema: "bazaar",
table: "prebuilt_decks",
column: "IsStarterDeck");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_prebuilt_decks_IsStarterDeck",
schema: "bazaar",
table: "prebuilt_decks");
migrationBuilder.DropColumn(
name: "IsStarterDeck",
schema: "bazaar",
table: "prebuilt_decks");
}
}
}
@@ -194,6 +194,9 @@ namespace SOR.Database.Migrations.Bazaar
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("IsStarterDeck")
.HasColumnType("boolean");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasMaxLength(200) .HasMaxLength(200)
@@ -212,6 +215,8 @@ namespace SOR.Database.Migrations.Bazaar
b.HasIndex("IsActive"); b.HasIndex("IsActive");
b.HasIndex("IsStarterDeck");
b.ToTable("prebuilt_decks", "bazaar"); b.ToTable("prebuilt_decks", "bazaar");
}); });
@@ -0,0 +1,321 @@
// <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.Catalog
{
[DbContext(typeof(CatalogDbContext))]
[Migration("20260225190934_AddAiGeneratedFlags")]
partial class AddAiGeneratedFlags
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("catalog")
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ActionName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AnimationCdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("CardDefinitionId", "ActionName")
.IsUnique();
b.ToTable("card_animation_bindings", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AssetType")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<string>("CdnUrl")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.Property<string>("MimeType")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CardDefinitionId", "AssetType");
b.ToTable("card_assets", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AbilitiesJson")
.HasColumnType("jsonb")
.HasColumnName("abilities");
b.Property<string>("Affinity")
.IsRequired()
.HasColumnType("text");
b.Property<string>("AttackType")
.HasColumnType("text");
b.Property<bool?>("CanAttack")
.HasColumnType("boolean");
b.Property<bool?>("CanBeAttacked")
.HasColumnType("boolean");
b.Property<bool?>("CanBeBlocked")
.HasColumnType("boolean");
b.Property<bool?>("CanBeObstructed")
.HasColumnType("boolean");
b.Property<bool?>("CanBeSacrificed")
.HasColumnType("boolean");
b.Property<bool?>("CanDefend")
.HasColumnType("boolean");
b.Property<bool?>("CanMove")
.HasColumnType("boolean");
b.Property<bool?>("CanUseAbility")
.HasColumnType("boolean");
b.Property<string>("CardType")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("CollectorNumber")
.HasColumnType("integer");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int?>("Damage")
.HasColumnType("integer");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EffectsJson")
.HasColumnType("jsonb")
.HasColumnName("effects");
b.Property<string[]>("Genus")
.HasColumnType("text[]");
b.Property<bool>("IsPublished")
.HasColumnType("boolean");
b.Property<int?>("MaxAttackRange")
.HasColumnType("integer");
b.Property<int?>("MaxChannelRange")
.HasColumnType("integer");
b.Property<int?>("MaxDefense")
.HasColumnType("integer");
b.Property<int?>("MaxHealth")
.HasColumnType("integer");
b.Property<int?>("MinAttackRange")
.HasColumnType("integer");
b.Property<int?>("MinChannelRange")
.HasColumnType("integer");
b.Property<int?>("MovementPoints")
.HasColumnType("integer");
b.Property<string>("MovementType")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("OtherCostsJson")
.HasColumnType("jsonb")
.HasColumnName("other_costs");
b.Property<Guid?>("PreviousTierId")
.HasColumnType("uuid");
b.Property<string>("Rarity")
.IsRequired()
.HasColumnType("text");
b.Property<bool?>("RequiresLos")
.HasColumnType("boolean");
b.Property<Guid?>("SetId")
.HasColumnType("uuid");
b.Property<int>("SpCost")
.HasColumnType("integer");
b.Property<int>("StCost")
.HasColumnType("integer");
b.Property<string>("TerramorphaMode")
.HasColumnType("text");
b.Property<int?>("Tier")
.HasColumnType("integer");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Affinity");
b.HasIndex("CardType");
b.HasIndex("Name");
b.HasIndex("PreviousTierId");
b.HasIndex("Rarity");
b.HasIndex("SetId");
b.HasIndex("IsPublished", "SetId");
b.ToTable("card_definitions", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateOnly?>("ReleaseDate")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.ToTable("card_sets", "catalog");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
.WithMany("AnimationBindings")
.HasForeignKey("CardDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CardDefinition");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
.WithMany("Assets")
.HasForeignKey("CardDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CardDefinition");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "PreviousTier")
.WithMany()
.HasForeignKey("PreviousTierId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("SOR.Database.Entities.Catalog.CardSet", "Set")
.WithMany("Cards")
.HasForeignKey("SetId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("PreviousTier");
b.Navigation("Set");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
{
b.Navigation("AnimationBindings");
b.Navigation("Assets");
});
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
{
b.Navigation("Cards");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Catalog
{
/// <inheritdoc />
public partial class AddAiGeneratedFlags : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsAiGenerated",
schema: "catalog",
table: "card_assets",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsAiGenerated",
schema: "catalog",
table: "card_animation_bindings",
type: "boolean",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsAiGenerated",
schema: "catalog",
table: "card_assets");
migrationBuilder.DropColumn(
name: "IsAiGenerated",
schema: "catalog",
table: "card_animation_bindings");
}
}
}
@@ -40,6 +40,9 @@ namespace SOR.Database.Migrations.Catalog
b.Property<Guid>("CardDefinitionId") b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CardDefinitionId", "ActionName") b.HasIndex("CardDefinitionId", "ActionName")
@@ -68,6 +71,9 @@ namespace SOR.Database.Migrations.Catalog
b.Property<DateTimeOffset>("CreatedAt") b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
b.Property<bool>("IsAiGenerated")
.HasColumnType("boolean");
b.Property<string>("MimeType") b.Property<string>("MimeType")
.HasColumnType("text"); .HasColumnType("text");
@@ -0,0 +1,140 @@
// <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.Collection
{
[DbContext(typeof(CollectionDbContext))]
[Migration("20260225190922_AddStarterDeckAndTradeability")]
partial class AddStarterDeckAndTradeability
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("collection")
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SOR.Database.Entities.Collection.Deck", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AccountId")
.HasColumnType("uuid");
b.Property<Guid>("ArchSpiritCardDefinitionId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsValid")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("AccountId");
b.ToTable("decks", "collection");
});
modelBuilder.Entity("SOR.Database.Entities.Collection.DeckCard", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<Guid>("DeckId")
.HasColumnType("uuid");
b.Property<int>("Quantity")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DeckId", "CardDefinitionId")
.IsUnique();
b.ToTable("deck_cards", "collection");
});
modelBuilder.Entity("SOR.Database.Entities.Collection.PlayerCard", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AccountId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("AcquiredAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("CardDefinitionId")
.HasColumnType("uuid");
b.Property<bool>("IsFoil")
.HasColumnType("boolean");
b.Property<bool>("IsTradeable")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property<int?>("SerialNumber")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AccountId");
b.HasIndex("AccountId", "CardDefinitionId");
b.ToTable("player_cards", "collection");
});
modelBuilder.Entity("SOR.Database.Entities.Collection.DeckCard", b =>
{
b.HasOne("SOR.Database.Entities.Collection.Deck", "Deck")
.WithMany("Cards")
.HasForeignKey("DeckId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Deck");
});
modelBuilder.Entity("SOR.Database.Entities.Collection.Deck", b =>
{
b.Navigation("Cards");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Collection
{
/// <inheritdoc />
public partial class AddStarterDeckAndTradeability : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsTradeable",
schema: "collection",
table: "player_cards",
type: "boolean",
nullable: false,
defaultValue: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsTradeable",
schema: "collection",
table: "player_cards");
}
}
}
@@ -99,6 +99,11 @@ namespace SOR.Database.Migrations.Collection
b.Property<bool>("IsFoil") b.Property<bool>("IsFoil")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("IsTradeable")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property<int?>("SerialNumber") b.Property<int?>("SerialNumber")
.HasColumnType("integer"); .HasColumnType("integer");
@@ -0,0 +1,368 @@
// <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.Identity
{
[DbContext(typeof(SorIdentityDbContext))]
[Migration("20260225190931_AddStarterDeckSelectedAt")]
partial class AddStarterDeckSelectedAt
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("identity")
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("roles", "identity");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("role_claims", "identity");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("account_claims", "identity");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("external_logins", "identity");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("account_roles", "identity");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("account_tokens", "identity");
});
modelBuilder.Entity("SOR.Database.Entities.Identity.Account", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("AvatarCdnUrl")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("DisplayName")
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LastLoginAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<DateTimeOffset?>("StarterDeckSelectedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("DisplayName");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("accounts", "identity");
});
modelBuilder.Entity("SOR.Database.Entities.Identity.AccountProperty", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AccountId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("AccountId");
b.HasIndex("AccountId", "Key")
.IsUnique();
b.ToTable("account_properties", "identity");
});
modelBuilder.Entity("SOR.Database.Entities.Identity.AccountSession", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AccountId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("DeviceId")
.HasColumnType("text");
b.Property<DateTimeOffset>("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("IpAddress")
.HasColumnType("text");
b.Property<DateTimeOffset?>("RevokedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("TokenHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("UserAgent")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TokenHash")
.IsUnique();
b.HasIndex("AccountId", "ExpiresAt");
b.ToTable("account_sessions", "identity");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.HasOne("SOR.Database.Entities.Identity.Account", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.HasOne("SOR.Database.Entities.Identity.Account", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SOR.Database.Entities.Identity.Account", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.HasOne("SOR.Database.Entities.Identity.Account", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SOR.Database.Migrations.Identity
{
/// <inheritdoc />
public partial class AddStarterDeckSelectedAt : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTimeOffset>(
name: "StarterDeckSelectedAt",
schema: "identity",
table: "accounts",
type: "timestamp with time zone",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "StarterDeckSelectedAt",
schema: "identity",
table: "accounts");
}
}
}
@@ -211,6 +211,9 @@ namespace SOR.Database.Migrations.Identity
b.Property<string>("SecurityStamp") b.Property<string>("SecurityStamp")
.HasColumnType("text"); .HasColumnType("text");
b.Property<DateTimeOffset?>("StarterDeckSelectedAt")
.HasColumnType("timestamp with time zone");
b.Property<bool>("TwoFactorEnabled") b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean"); .HasColumnType("boolean");