feat(sysadmin): the venue's menu and ordering links from PUBLIC_APPS_URL; 3S pack notes
Plan phase 3S, step S.99. - SiteOut.apps_url (the cloud's PUBLIC_APPS_URL; a Site property, not stored per site). - Sysadmin site page: the QR menu and online ordering links/QR codes are built from it (were a hard-coded IP and a "/menu/<site>/order" route that never existed); a note when PUBLIC_APPS_URL isn't set, and that table codes are printed by the venue. - Pack README: connect_frontend and /api/menu rows for phase 3S, CL-9 (rate limits are per process), CL-10 (table QR tokens: hashes only). - Test: the sysadmin gets the apps address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,3 +41,10 @@ class Site(Base):
|
||||
# What the site reported it can run (heartbeat `module_catalog`, D-20): drives the editor.
|
||||
module_catalog = Column(JSON, nullable=True)
|
||||
module_catalog_at = Column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
@property
|
||||
def apps_url(self) -> str | None:
|
||||
"""Where customers open this cloud's apps (PUBLIC_APPS_URL; phase 3S): the sysadmin's
|
||||
menu and ordering links are built from it. Not stored per site."""
|
||||
from config import settings
|
||||
return settings.PUBLIC_APPS_URL.rstrip("/") or None
|
||||
|
||||
@@ -56,6 +56,7 @@ class SiteOut(BaseModel):
|
||||
menu_blurb_gr: str | None
|
||||
menu_hours: str | None
|
||||
menu_header_image_url: str | None
|
||||
apps_url: str | None = None # PUBLIC_APPS_URL: the customer apps' address (phase 3S)
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
@@ -60,3 +60,11 @@ def test_read_only_menus_take_no_table_orders(client, admin_h):
|
||||
r = client.put(f"/api/sites/{site['site_id']}", headers=admin_h, json={"menu_mode": "view_only"})
|
||||
assert r.status_code == 200, r.text
|
||||
assert _code(_order(client, site, "dine_in", table_token="tok-five", items=[{"product_id": PIE, "quantity": 1}])) == "order.service_unavailable"
|
||||
|
||||
|
||||
def test_the_sysadmin_gets_the_apps_address(client, admin_h, monkeypatch):
|
||||
from config import settings
|
||||
site, _ = _venue(client, admin_h)
|
||||
monkeypatch.setattr(settings, "PUBLIC_APPS_URL", "https://menu.example.com/")
|
||||
got = client.get(f"/api/sites/{site['site_id']}", headers=admin_h).json()
|
||||
assert got["apps_url"] == "https://menu.example.com"
|
||||
|
||||
Reference in New Issue
Block a user