Skip to content

Reservation

1. Overview

PropertyValue
IDFEAT-SALE-RES
StatusStable
Ownersale-team
Depends onAllocationUnit, AllocationUsage, SaleOrder (post check-in), Customer (optional)

Reservation captures a future booking with guest details, party size, and time window. Creating a reservation also creates one or more AllocationUsage rows (status ACTIVE) holding the unit(s) until check-in or cancellation. On check-in, sale spawns a SaleOrder and re-targets the usage rows.

2. Entity Model

Field details — see Domain Model §3.6.

3. Lifecycle

FromEventToSide effect
PENDINGconfirmCONFIRMEDoptional notification
CONFIRMEDcheck-inCHECKED_INcreate SaleOrder, retarget AllocationUsage to usageType=SALE_ORDER
* (non-terminal)cancelCANCELLEDcascade cancel AllocationUsage
CONFIRMEDreservedTo elapsed(manual)sweep job marks AllocationUsage.EXPIRED

4. Operations

ReservationService (reservation.service.ts — 686 lines).

MethodSignaturePurpose
create{ context, data: TCreateReservationRequest } (line 112)Reservation + AllocationUsage rows in one TX
checkIn{ id, ... } (line 423)CONFIRMED → CHECKED_IN; spawn SaleOrder
cancel{ id, cancellationReason? } (line 340)non-terminal → CANCELLED + cascade

No dedicated confirm service method or REST endpoint today. PENDING → CONFIRMED transition is performed via CRUD updateById with status: CONFIRMED (handled by MerchantScopedService inheritance).

5. REST Endpoints

VerbPathAuthPermissionHandler
6× CRUD/reservationsJWT/BASICReservation.<crud>merchant-scoped (covers create + status updates)
POST/reservationsJWT/BASICReservation.createReservationService.create (with allocation in same TX)
POST/reservations/:id/check-inJWT/BASICReservation.checkIncheckIn
POST/reservations/:id/cancelJWT/BASICReservation.cancelcancel

No /confirm endpoint — confirmation is via CRUD PATCH /reservations/:id with { status: 'CONFIRMED' }.

Live OpenAPI: /v1/api/sale/doc/openapi.json.

6. Events

Outbound (WebSocket):

TopicWhenAction enum
observation/sale/reservationcreateRESERVATION_CREATED
sameconfirmRESERVATION_CONFIRMED
samecancelRESERVATION_CANCELLED
samecheck-inRESERVATION_CHECKED_IN
observation/allocation/allocation-usagecreate/cancel/check-inUSAGE_CREATED / USAGE_CANCELLED

Rooms via getReservationRooms (merchant + reservation + allocation unit/zone hierarchy).

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.