fix(config): DraftSnapshotFactory loads only active (unreleased) reservations

Filter ExternalIdReservations to WHERE ReleasedAt IS NULL so
DraftSnapshot.ActiveReservations matches its documented semantics and
ValidateReservationPreflight cannot emit spurious BadDuplicateExternalIdentifier
errors from already-released rows. Adds a focused unit test seeding one active
and one released reservation and asserting only the active row is returned.
This commit is contained in:
Joseph Doherty
2026-06-07 10:47:33 -04:00
parent 1023209d52
commit 46aba992c5
2 changed files with 42 additions and 1 deletions
@@ -43,6 +43,9 @@ public static class DraftSnapshotFactory
VirtualTags = await db.VirtualTags.AsNoTracking().ToListAsync(ct),
PollGroups = await db.PollGroups.AsNoTracking().ToListAsync(ct),
PriorEquipment = [],
ActiveReservations = await db.ExternalIdReservations.AsNoTracking().ToListAsync(ct),
ActiveReservations = await db.ExternalIdReservations
.AsNoTracking()
.Where(r => r.ReleasedAt == null) // active only — matches DraftSnapshot.ActiveReservations semantics
.ToListAsync(ct),
};
}