Booking Lifecycle
The booking system manages tee time reservations through a state machine with holds, confirmations, cancellations, and rescheduling.
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ POST /hold │────▶│ PENDING │────▶│ POST /confirm │
│ (create hold) │ │ (slot held) │ │ (finalize) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
▼ ▼
┌──────────────────┐ ┌─────────────────┐
│ DELETE │ │ CONFIRMED │
│ (release) │ │ (booked) │
└──────────────────┘ └─────────────────┘
│ │
▼ ▼
┌──────────────────┐ ┌─────────────────┐
│ CANCELLED │◀────│ DELETE │
│ (slot free) │ │ (cancel) │
└─────────────────┘ └─────────────────┘
Source: libs/tee-time-services/src/lib/facade/booking.controller.ts
Slot States
| State | Description | Booking Status |
|---|---|---|
AVAILABLE | Open for booking | None |
HELD | Temporarily reserved | PENDING |
BOOKED | Permanently reserved | CONFIRMED |
BLOCKED | Administratively blocked | None |
Booking States
| Status | Description | Next States |
|---|---|---|
PENDING | Hold created, awaiting confirmation | CONFIRMED, CANCELLED |
CONFIRMED | Booking finalized with payment | CANCELLED |
CANCELLED | Booking cancelled, slot released | Terminal |
Payment Status
| Status | Trigger |
|---|---|
UNPAID | Default on hold creation |
AUTHORIZED | Payment authorized but not captured |
CAPTURED | Payment captured on confirm |
REFUNDED | Refund processed after cancellation |