A cart checks out.
POST /orders → createOrder
src/db/orders.ts · one transaction
check"Cart is empty" → 400
ORDERS← new row, status 'pending'
STOCK.RESERVED← + quantity per line
ours src/db/orders.ts · createOrder
SQL
UPDATE "STOCK"
SET "RESERVED" = "RESERVED" + qty
WHERE "PRODUCT_ID" = id AND "ON_HAND" - "RESERVED" >= qty
never oversells