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:
@@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user