Ir al contenido principal
Petanque Life

Booking Engine (PL-T186)

F22.04 15 funcionalidades

En resumen

The transactional core of the chain-venue platform. Create, update, cancel and check-in bookings with race-free conflict detection via per-(tenant, location) asyncio locks, idempotent submits keyed by client UUID, atomic multi-resource reservations as a single document, no-show grace-period auto-flip, full audit trail per status change, suggested-slot recovery on conflicts, and real-time SSE broadcasts to every connected console and customer page.

Cómo funciona

Every mutation flows through the booking engine. On create, the engine acquires a per-(tenant, location) asyncio lock, validates against opening hours (via the effective-hours resolver), maintenance blocks (via the expansion service), buffer rules, and resource capacity, then writes the Booking document with status RESERVED. Idempotency keys passed by the client cause repeated submits to return the same booking rather than duplicating — critical for flaky mobile networks during checkout.

Multi-resource bookings (e.g. "three adjacent lanes for a corporate event") are stored as a single Booking with a list[resource_ids], so the reservation is atomic — no half-booked groups. Conflict responses don't dead-end the customer: the engine returns suggested_slots from a ±2 h scan around the requested time plus a can_join_waitlist boolean, and the front-end renders alternatives with one-tap selection. Status transitions (RESERVED → CONFIRMED → CHECKED_IN → COMPLETED, or any path to CANCELLED / NO_SHOW) are recorded in an audit_trail array on the document — actor, action, timestamp, optional metadata.

No-show logic runs on a grace period from ChainVenueProfile (e.g. 15 minutes after start time, the booking auto-flips to NO_SHOW unless an operator checks it in). Every status change broadcasts on an SSE channel chain.bookings.{tenant}.{location}, so the calendar, floorplan, and operator console all refresh within a few hundred milliseconds without polling.

Capacidades clave

  • Race-free conflict detection via per-(tenant, location) asyncio lock
  • Idempotency keys + atomic multi-resource bookings (list of resource_ids)
  • Conflict response carries suggested_slots (±2 h scan) + can_join_waitlist
  • Full status audit trail on every transition
  • No-show auto-flip on configurable grace period
  • SSE broadcasts on chain.bookings.{tenant}.{location}
  • Wait-list FIFO queue with promotion-on-free integration

En la práctica

A customer on the tenant CMS picks Saturday 19:30 for a party of six on three adjacent lanes. The wizard POSTs a single booking with three resource_ids and an idempotency key generated client-side. The engine acquires the lane-lock, validates that all three lanes are free, writes one Booking document, releases the lock, and returns 201.

Two seconds later another customer tries to book Lane 2 for the same slot — the engine returns 409 with three suggested ±2 h slots plus a wait-list option. They tap the 20:00 alternative and confirm. Both bookings appear instantly on the venue's wall-mounted floorplan via SSE, and the operator behind the bar sees the new arrivals in the upcoming-arrivals strip without ever clicking refresh.

Funcionalidades de este subsistema

15
ID Status Funcionalidades
F22.04.01 Entregado Create / update / cancel booking with conflict detection
F22.04.02 Entregado Booking validation (opening hours, buffer, capacity)
F22.04.03 Entregado No-show logic with grace period
F22.04.04 Entregado Audit trail per status change
F22.04.05 Entregado Idempotency keys on create
F22.04.06 Entregado WaitListEntry FIFO queue with promotion-on-free
F22.04.07 Entregado SSE broadcast on status change (chain.bookings.<tenant>.<location>)
F22.04.08 Entregado Multi-resource atomic booking (single document, list[resource_ids])
F22.04.09 Entregado Per-(tenant,location) asyncio lock for race-free conflict check
F22.04.10 Entregado Conflict response with suggested_slots (±2h scan) and can_join_waitlist
F22.04.20 Entregado Restricted facility booking (military/school/civic/private_corporate/religious) with permission-gated flow (PL-T217)
F22.04.21 Entregado Approval-chain (host_admin → security_officer → optional government_clearance) with role-allow-lists och self-approval-skydd (PL-T217)
F22.04.22 Entregado Access-log audit (checkin/checkout/access_denied) med dispatch till security_officers vid access_denied (PL-T217)
F22.04.23 Entregado Host-operations-konfliktcheck mot iCal-calendar + restricted_facility_request_expiry_tick (24h-cutoff) (PL-T217)
F22.04.30 Entregado Shared-facility-overlay — Booking.shared_facility_owner_tenant_id exponerar bokningen som read-only-spegel hos delägar-tenant via list_for_tenant_including_shared (PL-T224)

Partes interesadas que necesitan este subsistema

Aparece en 1 análisis de partes interesadas