operations-dal/docs/architecture/restaurant-lifecycle-store.md
2026-03-31 18:06:29 -06:00

1.2 KiB

Restaurant Lifecycle Store

Related Master Plan: plan/2026-03-31-s44-master-shared-restaurant-lifecycle.md

Purpose

operations-dal persists the shared restaurant order and check state that waiter, customer, kitchen, and POS flows will operate on together.

Persisted Shapes

Order and Check Record

The lifecycle store keeps one shared record per restaurant order containing:

  • ContextId
  • OrderId
  • CheckId
  • TableId
  • OrderState
  • CheckState
  • GuestCount
  • HasKitchenTicket
  • OutstandingBalance
  • Currency
  • Source
  • ItemIds
  • UpdatedAtUtc

Event History

The store also keeps an append-only event stream per order so services and BFFs can expose recent lifecycle activity without synthesizing it from isolated arrays.

Query Shape

The DAL exposes internal access patterns for:

  • load one order by context and order id
  • list orders by context
  • list payable orders by context
  • append and list lifecycle events by order

Ownership Boundary

  • operations-domain owns the lifecycle rules.
  • operations-dal owns durable storage for the shared restaurant order/check state.
  • kitchen-dal will persist kitchen ticket execution separately while sharing the restaurant identities.