feat(cloud): the online ordering app (takeaway, delivery) with hours, time slots and rate limits (platform-v2 3S, S.4)
- connect_frontend/order-app at /order/{site}: menu per service at that service's prices,
extras, basket (kept per tab), checkout priced by the cloud (fee, area by list or
postcode, minimum), name/phone/address/notes (remembered), as soon as possible or a time
slot, tracking page with steps, lines and totals; en/el; tokens in index.css. Logic in
src/logic.js, unit-tested; built and served by the connect image (npm test in the build).
- services/ordering.py: the venue's services, hours (past midnight), preparation, slot grid,
days ahead, ASAP; takeaway/delivery orders checked (order.service_unavailable,
order.closed, order.time_invalid) and need a phone; GET /api/orders/{site}/slots; the
public menu carries the ordering summary.
- services/ratelimit.py: per-caller limits on quote, order and track (429 rate.limited).
- online_orders.requested_for (0003, unreleased) stored as UTC; every datetime sent with its
offset (the database keeps no zone: a 12:00 Athens slot came back as 12:00 unzoned).
- Tracking returns what was ordered, the totals, the type and the time.
- Tests: test_ordering.py (5), checkout/fees updated; order-app unit (4).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -14,7 +14,7 @@ This folder is its **own git repo**, nested inside the `xenia-pos` parent repo.
|
||||
|---|---|---|---|
|
||||
| `cloud_backend` | FastAPI + SQLAlchemy + SQLite (`${BACKEND_DATA}`) | 8001 | local sites (heartbeat/sync), sysadmin, connect apps |
|
||||
| `sysadmin_panel` | React + Vite (`VITE_CLOUD_URL` baked in at build) | 5175 | the developer only |
|
||||
| `connect_frontend` | nginx serving two SPAs: `menu-app` at `/menu/`, `manager-app` at `/manage/` | 3100 | restaurant customers (QR menu), remote managers |
|
||||
| `connect_frontend` | nginx serving three SPAs: `menu-app` at `/menu/` (QR menu), `order-app` at `/order/` (online ordering: takeaway, delivery; phase 3S), `manager-app` at `/manage/` | 3100 | restaurant customers, remote managers |
|
||||
|
||||
TLS and domains are handled in front of these ports on the VPS (`xenia-api.bonamin.net` → cloud_backend, `xenia-admin.bonamin.net` → sysadmin panel, `registry.bonamin.net` → image registry).
|
||||
|
||||
@@ -26,7 +26,7 @@ TLS and domains are handled in front of these ports on the VPS (`xenia-api.bonam
|
||||
| `/api/sites` | `sites.py` | admin bearer | sysadmin panel |
|
||||
| `/api/heartbeat` | `heartbeat.py` | `X-Site-ID` + `X-Site-Key` | local sites |
|
||||
| `/api/menu` | `menu.py` | public GET; site headers for sync | menu-app, local sites |
|
||||
| `/api/orders` | `orders.py` | public create/quote/track (priced by `services/checkout.py` from the site's snapshot, never the browser's numbers); site headers for pending/synced/status (own site only) | menu-app, local sites |
|
||||
| `/api/orders` | `orders.py` | public create/quote/slots/track (priced by `services/checkout.py`, fees `services/fees.py`, hours and slots `services/ordering.py`, rate-limited `services/ratelimit.py`; never the browser's numbers); site headers for pending/synced/status (own site only) | menu-app, order-app, local sites |
|
||||
| `/api/manager` | `manager_auth.py` | manager bearer | manager-app, sysadmin |
|
||||
| `/api/remote` | `remote_dashboard.py` | manager bearer; site headers for `POST /snapshot` | manager-app, local sites |
|
||||
|
||||
@@ -74,6 +74,7 @@ cd cloud_backend && uvicorn main:app --reload --port 8001
|
||||
cd cloud_backend && python -m pytest tests -q # schema guards, licensing v2 (pip install -r requirements-dev.txt)
|
||||
cd sysadmin_panel && npm run dev
|
||||
cd connect_frontend/menu-app && npm run dev
|
||||
cd connect_frontend/order-app && npm run dev && npm test # VITE_CLOUD_URL=http://localhost:8001; e2e: client-services/tests/e2e/order_app.mjs
|
||||
cd connect_frontend/manager-app && npm run dev
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user