Add Bazaar store products — booster packs, prebuilt decks, masked listings
- BoosterPack entity: dual pricing (OP + USD), JSONB slot distribution, availability window, CDN image, IsActive flag - PrebuiltDeck entity: dual pricing, ArchSpirit reference (denormalized), availability window, CDN image, card list (PrebuiltDeckCard) - BazaarListing.IsMasked: blind/mystery market — buyers see rarity+type only - BazaarDbContext: new DbSets, EF config (jsonb column, unique indexes, cascade delete on deck cards) - Migration: AddBazaarStoreProducts (applied to pg-forge-01) - Admin UI: BoosterPackList, BoosterPackEditor (slot editor, image upload), PrebuiltDeckList, PrebuiltDeckEditor (cross-context card search, ArchSpirit picker) - BazaarOverview: add active packs/decks stat cards with manage links - NavMenu: add Booster Packs + Prebuilt Decks sub-items under Bazaar 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:
@@ -25,10 +25,19 @@ public sealed class BazaarListing
|
||||
|
||||
public BazaarListingType ListingType { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
public BazaarCurrency Currency { get; set; }
|
||||
|
||||
/// <summary>Players may only list for origin points (Gold). USD is reserved for store products.</summary>
|
||||
public BazaarCurrency Currency { get; set; } = BazaarCurrency.Gold;
|
||||
|
||||
public DateTimeOffset ListedAt { get; set; }
|
||||
public DateTimeOffset? ExpiresAt { get; set; }
|
||||
public BazaarListingStatus Status { get; set; } = BazaarListingStatus.Active;
|
||||
|
||||
/// <summary>
|
||||
/// When true, the card's identity (name, art, specific definition) is hidden from buyers.
|
||||
/// Buyers see only the rarity and card type — a blind/mystery listing.
|
||||
/// </summary>
|
||||
public bool IsMasked { get; set; }
|
||||
|
||||
public ICollection<BazaarTransaction> Transactions { get; set; } = new List<BazaarTransaction>();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
namespace SOR.Database.Entities.Bazaar;
|
||||
|
||||
/// <summary>
|
||||
/// A purchasable booster pack product.
|
||||
///
|
||||
/// SlotsJson defines the card distribution as a JSONB array:
|
||||
/// [{"rarity":"Common","count":5},{"rarity":"Rare","count":2},{"rarity":"Legendary","count":1}]
|
||||
/// When a player opens a pack the server draws randomly from eligible card pools per slot.
|
||||
///
|
||||
/// Dual-currency pricing:
|
||||
/// OriginPointPrice — in-game earned currency, always set.
|
||||
/// UsdPrice — real-money price; null if not available for direct purchase.
|
||||
///
|
||||
/// Availability is controlled by AvailableFrom / AvailableUntil:
|
||||
/// null/null → no time restriction (always available while IsActive)
|
||||
/// From only → available from that date onward
|
||||
/// Until only → available until that date
|
||||
/// Both → available only within that window
|
||||
/// </summary>
|
||||
public sealed class BoosterPack
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string? Description { get; set; }
|
||||
public string? ImageCdnUrl { get; set; }
|
||||
|
||||
/// <summary>Cost in origin points (in-game earned currency).</summary>
|
||||
public int OriginPointPrice { get; set; }
|
||||
|
||||
/// <summary>Cost in USD. Null if not sold for real money.</summary>
|
||||
public decimal? UsdPrice { get; set; }
|
||||
|
||||
public DateTimeOffset? AvailableFrom { get; set; }
|
||||
public DateTimeOffset? AvailableUntil { get; set; }
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// JSONB slot distribution, e.g.:
|
||||
/// [{"rarity":"Common","count":5},{"rarity":"Rare","count":2},{"rarity":"Legendary","count":1}]
|
||||
/// </summary>
|
||||
public string? SlotsJson { get; set; }
|
||||
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
namespace SOR.Database.Entities.Bazaar;
|
||||
|
||||
/// <summary>
|
||||
/// A purchasable prebuilt deck product.
|
||||
///
|
||||
/// Contains a curated list of cards (PrebuiltDeckCard) and a designated ArchSpirit.
|
||||
/// Players purchase the deck and receive all cards as PlayerCard instances.
|
||||
///
|
||||
/// Cross-schema references (ArchSpiritCardDefinitionId, cards) are bare Guids — no EF FKs.
|
||||
/// </summary>
|
||||
public sealed class PrebuiltDeck
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string? Description { get; set; }
|
||||
public string? ImageCdnUrl { get; set; }
|
||||
|
||||
/// <summary>Cost in origin points.</summary>
|
||||
public int OriginPointPrice { get; set; }
|
||||
|
||||
/// <summary>Cost in USD. Null if not sold for real money.</summary>
|
||||
public decimal? UsdPrice { get; set; }
|
||||
|
||||
public DateTimeOffset? AvailableFrom { get; set; }
|
||||
public DateTimeOffset? AvailableUntil { get; set; }
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
/// <summary>Cross-schema: the ArchSpirit card included in this deck. Bare Guid.</summary>
|
||||
public Guid? ArchSpiritCardDefinitionId { get; set; }
|
||||
|
||||
/// <summary>Denormalized display name of the ArchSpirit — avoids cross-context lookups.</summary>
|
||||
public string? ArchSpiritName { get; set; }
|
||||
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
|
||||
public ICollection<PrebuiltDeckCard> Cards { get; set; } = new List<PrebuiltDeckCard>();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace SOR.Database.Entities.Bazaar;
|
||||
|
||||
/// <summary>
|
||||
/// A card entry in a PrebuiltDeck.
|
||||
///
|
||||
/// CardDefinitionId is a bare cross-schema Guid (no EF FK to catalog schema).
|
||||
/// CardName is denormalized to avoid cross-DbContext lookups during display.
|
||||
/// </summary>
|
||||
public sealed class PrebuiltDeckCard
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public Guid PrebuiltDeckId { get; set; }
|
||||
public PrebuiltDeck PrebuiltDeck { get; set; } = null!;
|
||||
|
||||
/// <summary>Cross-schema: the card definition. Bare Guid, no EF FK.</summary>
|
||||
public Guid CardDefinitionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Denormalized card name for display without querying the catalog DbContext.
|
||||
/// Updated when the card editor saves a name change.
|
||||
/// </summary>
|
||||
public string CardName { get; set; } = string.Empty;
|
||||
|
||||
public int Quantity { get; set; } = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user