Availability Engine & Interval Trees
High-speed slot calculation, blackout windows, maintenance blocks, and operating hour constraints.
The availability engine calculates bookable slots across time horizons by intersecting operating hours, reservations, and blackout intervals.
Interval Tree Slot Calculation
High-speed interval math calculating available slots in sub-millisecond response times.
src/Modules/Venue/Venue.Application/Services/AvailabilityService.csC#
public async Task<IReadOnlyList<TimeSlot>> CalculateAvailableSlotsAsync(
Guid resourceId,
DateOnly targetDate,
CancellationToken ct = default)
{
var operatingHours = await _hoursRepo.GetByResourceAsync(resourceId, targetDate.DayOfWeek, ct);
var confirmedReservations = await _resRepo.GetActiveByDateAsync(resourceId, targetDate, ct);
var activeHolds = await _holdsRepo.GetActiveHoldsAsync(resourceId, targetDate, ct);
var blackouts = await _blackoutsRepo.GetOverlappingAsync(resourceId, targetDate, ct);
return IntervalTreeCalculator.ComputeFreeIntervals(
operatingHours.OpenTimeUtc,
operatingHours.CloseTimeUtc,
confirmedReservations.Concat(activeHolds).Concat(blackouts),
granularityMinutes: 30
);
}Maintenance & Blackout Windows
Impose immediate resource closures for unexpected maintenance or tournament takeovers.
Availability Resolution APIs
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/v1/venue/availability | Evaluate open slots for resource and date range | 🔒 Required |
| POST | /api/v1/venue/blackouts | Create maintenance blackout window | 🔒 Required |