Use existence checks for archspirit validation
This commit is contained in:
@@ -56,12 +56,12 @@ internal sealed class CollectionCreateDeckHandler : CollectionHandlerBase, IMess
|
||||
$"Maximum of {DeckRules.MaxDecksPerPlayer} decks reached.");
|
||||
|
||||
// ── Validate ArchSpirit exists in catalog ──────────────────────────────
|
||||
var archDef = await _catalogDb.CardDefinitions
|
||||
.FirstOrDefaultAsync(
|
||||
var archSpiritExists = await _catalogDb.CardDefinitions
|
||||
.AnyAsync(
|
||||
cd => cd.Id == req.ArchSpiritCardDefinitionId
|
||||
&& cd.CardType == CardType.ArchSpirit,
|
||||
cancellationToken);
|
||||
if (archDef == null)
|
||||
if (!archSpiritExists)
|
||||
return ServerMessage.Error(message.Seq, "INVALID_ARCH_SPIRIT",
|
||||
"That card is not a valid ArchSpirit.");
|
||||
|
||||
|
||||
@@ -51,12 +51,12 @@ internal sealed class CollectionSetArchSpiritHandler : CollectionHandlerBase, IM
|
||||
return ServerMessage.Error(message.Seq, "DECK_NOT_FOUND", "Deck not found.");
|
||||
|
||||
// ── Validate ArchSpirit exists in catalog ──────────────────────────────
|
||||
var archDef = await _catalogDb.CardDefinitions
|
||||
.FirstOrDefaultAsync(
|
||||
var archSpiritExists = await _catalogDb.CardDefinitions
|
||||
.AnyAsync(
|
||||
cd => cd.Id == req.ArchSpiritCardDefinitionId
|
||||
&& cd.CardType == CardType.ArchSpirit,
|
||||
cancellationToken);
|
||||
if (archDef is null)
|
||||
if (!archSpiritExists)
|
||||
return ServerMessage.Error(message.Seq, "INVALID_ARCH_SPIRIT",
|
||||
"That card is not a valid ArchSpirit.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user