Skip to content

Allocation Usage

1. Overview

PropertyValue
IDFEAT-SALE-ALLOC
StatusStable
Ownersale-team
Depends onAllocationUnit, AllocationZone, AllocationLayout (allocation schema), SaleOrder, Reservation

Allocation occupancy uses a polymorphic AllocationUsage(usageType, usageId) row that ties an AllocationUnit (table/seat/locker) to either a SaleOrder or a Reservation. One usage row per allocated unit; same lifecycle for both parents. See ADR-0004.

2. Entity Model

Field details — see Domain Model §3.5.

3. Lifecycle

FromEventTo
ACTIVESaleOrder payment successSUCCESS
ACTIVEorder/reservation cancelCANCELLED
ACTIVEreservation reservedTo passed without check-inEXPIRED

4. Operations

AllocationUsageService (allocation-usage.service.ts — 841 lines).

MethodSignaturePurpose
startForOrder{ saleOrderId, merchantId, allocationUnitId, type, assigneeId? }Create ACTIVE usage tied to SaleOrder
complete{ usageId }ACTIVE → SUCCESS (called from payment-success handler)
moveUsagesToOrder{ fromOrderId, toOrderId }Used during order merge to retarget existing usages
resolvePrincipalIdsByAllocation{ unitId, zoneId, ... }Resolve order/reservation FROM unit/zone for routing
Batch cancel / completeper-spec endpointsBulk transitions

5. REST Endpoints

VerbPathAuthPermissionHandler
6× CRUD/allocation-usagesJWT/BASICAllocationUsage.<crud>merchant-scoped
GET/allocation-usages?zoneId=...&unitId=...JWT/BASICAllocationUsage.findfilter by zone/unit
Batch ops/allocation-usages/batch/...JWT/BASIC(per op)AllocationUsageService.*

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

6. Events

Outbound (WebSocket):

TopicWhenAction enumRooms
observation/allocation/allocation-usagestartForOrderUSAGE_CREATEDgetAllocationUsageRooms (merchant + unit + zone hierarchy)
samecompleteUSAGE_COMPLETEDsame
samecancelUSAGE_CANCELLEDsame

Outbound (Kafka): none directly — payment-success Kafka emit is owned by SaleOrderPaymentWebhookService.

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