orders.list
List in-stay orders for this tenant, newest-first. Filter by stayId (per-stay folio drill-down) or status (pending/confirmed/delivered/cancelled). Read-only.
Input parameters
| Field | Type | Required | Notes |
|---|---|---|---|
stayId | string | no | |
status | enum | no | One of: pending, confirmed, delivered, cancelled |
limit | integer | no | Default: 50 |
Output fields
| Field | Type | Required | Notes |
|---|---|---|---|
orders | array of object | yes | |
orders.id | string | yes | |
orders.stayId | string | yes | |
orders.itemId | string | yes | |
orders.quantity | integer | yes | |
orders.note | string · nullable | yes | |
orders.status | enum | yes | One of: pending, confirmed, delivered, cancelled |
orders.folioLineId | string · nullable | yes | |
orders.orderedAt | string | yes | |
orders.updatedAt | string | yes |
orders.listCatalog
Catalog read — all active items for this tenant, ordered by sortOrder. RLS pins to caller's tenant. Read-only query.
Input parameters
Returns object.
Output fields
Returns array of object. Fields of each element:
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
tenantId | string | yes | |
name | string | yes | |
description | string · nullable | yes | |
priceCents | integer | yes | |
currency | string | yes | |
category | string | yes | |
active | boolean | yes | |
sortOrder | integer | yes | |
createdAt | string | yes |
orders.listCatalogByToken
Public-by-token catalog read for the guest portal. Resolves the token → (tenantId, stayId) via `gueltigeGastSitzung`, then runs the actual catalog read inside withSystem(tenantId) with an explicit tenantId filter (Pattern A defense-in-depth). Read-only query.
Input parameters
| Field | Type | Required | Notes |
|---|---|---|---|
token | string | yes |
Output fields
Returns array of object. Fields of each element:
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
name | string | yes | |
description | string · nullable | yes | |
priceCents | integer | yes | |
currency | string | yes | |
category | string | yes |
orders.listOrders
List orders for this tenant. Optional filters by stay + status. Newest-first by orderedAt. Read-only query.
Input parameters
| Field | Type | Required | Notes |
|---|---|---|---|
stayId | string | no | |
status | enum | no | One of: pending, confirmed, delivered, cancelled |
Output fields
Returns array of object. Fields of each element:
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
tenantId | string | yes | |
stayId | string | yes | |
itemId | string | yes | |
quantity | integer | yes | |
note | string · nullable | yes | |
status | enum | yes | One of: pending, confirmed, delivered, cancelled |
folioLineId | string · nullable | yes | |
orderedAt | string | yes | |
updatedAt | string | yes |
orders.placeOrderByToken
Public-by-token order placement from the guest portal. Token is the auth principal — no session. Resolves (tenantId, stayId), then runs the verify + insert + folio-line side-effect inside withSystem(tenantId) with explicit tenantId filters. Mutation — changes data.
Input parameters
| Field | Type | Required | Notes |
|---|---|---|---|
token | string | yes | |
itemId | string | yes | |
quantity | integer | no | Default: 1 |
note | string | no |
Output fields
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
folioLineId | string · nullable | yes |
orders.place_order
Place an in-stay order on behalf of a guest. Verifies the catalog item belongs to this tenant + is active and the stay is this tenant's (else stay_not_found) with an open folio (else folio_closed), inserts the stay_orders row, then writes a folio_lines charge (VAT 19% for in-stay extras). Best-effort: if the folio insert fails the order still exists with folioLineId=NULL.
Input parameters
| Field | Type | Required | Notes |
|---|---|---|---|
stayId | string | yes | |
itemId | string | yes | |
quantity | integer | no | Default: 1 |
note | string | no |
Output fields
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
folioLineId | string · nullable | yes |
orders.updateOrderStatus
Set a guest order's status: confirmed / delivered / cancelled. Cancelled is final and cannot be undone; if the order had a folio line, a refund counter-line is booked in the folio. If the folio is already closed then, the call is rejected with folio_closed. Errors: order_not_found, order_cancelled, folio_closed. Requires confirmation.
Input parameters
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
status | enum | yes | One of: confirmed, delivered, cancelled |
Output fields
| Field | Type | Required | Notes |
|---|---|---|---|
ok | literal | yes | One of: true |
orders.update_status
Transition an order to confirmed / delivered / cancelled. Owner-only. Cancellation books one negative 'refund' folio line reversing the order's charge (the original line stays); repeating it is a no-op. A cancelled order cannot change again (order_cancelled). Cancelling an order with a folio charge on a closed folio fails with folio_closed. Confirmation-gated.
Input parameters
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
status | enum | yes | One of: confirmed, delivered, cancelled |
Output fields
| Field | Type | Required | Notes |
|---|---|---|---|
ok | literal | yes | One of: true |
orders.upsertCatalogItem
Catalog upsert — owner-only. Insert when no id, update otherwise. RLS scoping: update is `eq(id) AND eq(tenantId)` so a cross-tenant id is silently a no-op (Pattern-A silence). Mutation — changes data.
Input parameters
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | no | |
name | string | yes | |
description | string | no | |
priceCents | integer | yes | |
currency | string | no | Default: "EUR" |
category | string | no | Default: "general" |
active | boolean | no | Default: true |
sortOrder | integer | no | Default: 0 |
Output fields
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes |