Skip to content

Middleware — Availability

Folder: src/routes/availability/
Mount: api/v1/bookdirect/availability in config/routes.json
Status: API-first contract — to implement. Do not leave the final check in the browser.

Middleware · winner

POST https://middleware-dev.bookdirect.live/api/v1/bookdirect/availability/check

Frontend playbooks: Guest search, Checkout.

Then talk to Core (read only)

GET https://backend-dev.bookdirect.live/public/api/v1/nellalink/smart-meta-manager/entity/room?parent_entity_type=property&parent_entity_uuid={property_uuid}
GET https://backend-dev.bookdirect.live/public/api/v1/nellalink/smart-meta-manager/entity/rate_plan?parent_entity_type=room&parent_entity_uuid={room_uuid}
GET https://backend-dev.bookdirect.live/public/api/v1/nellalink/smart-meta-manager/entity/booking?parent_entity_type=rate_plan&parent_entity_uuid={rate_plan_uuid}&per_page=100

Shortlet: bookings where parent_entity_type=property. Inventory from property.extra_data.total_units (default 1).

Algorithm

Blocking statuses: pending, confirmed, checked_in.
Freeing: cancelled, checked_out.

Overlap: booking.check_in < search_check_out AND booking.check_out > search_check_in.

units_booked = SUM(extra_data.units_booked) for overlapping blocking bookings
available = room.extra_data.total_units - units_booked

If any blocked_dates range overlaps, available = 0 for that room.

Request / response

json
{
  "property_uuid": "{property_uuid}",
  "check_in": "2026-10-01",
  "check_out": "2026-10-03",
  "units_needed": 1
}
json
{
  "status": true,
  "status_code": 200,
  "data": {
    "property_uuid": "...",
    "plans": [
      {
        "room_uuid": "...",
        "rate_plan_uuid": "...",
        "total_units": 3,
        "available": 2
      }
    ]
  }
}

IDOR

Return counts only. Never include guest_email, guest_phone, or other booking PII. This route is readable with a site key + optional guest JWT.

API-first. Middleware wins over Core when both exist.