Add glue layer: replace /internal/menu-items API with direct DB query
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 46s

- Context processor: get_navigation_tree() replaces api_get("coop", "/internal/menu-items")
- Add glue submodule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-11 23:37:47 +00:00
parent ba10f5547a
commit f81d6803d4
3 changed files with 8 additions and 5 deletions

3
.gitmodules vendored
View File

@@ -2,3 +2,6 @@
path = shared
url = https://git.rose-ash.com/coop/shared.git
branch = decoupling
[submodule "glue"]
path = glue
url = /root/rose-ash/glue

9
app.py
View File

@@ -17,17 +17,16 @@ async def market_context() -> dict:
"""
Market app context processor.
- menu_items: fetched from coop internal API
- menu_items: direct DB query via glue layer
- cart_count/cart_total: fetched from cart internal API
"""
from shared.infrastructure.context import base_context
from shared.infrastructure.internal_api import get as api_get, dictobj
from glue.services.navigation import get_navigation_tree
from shared.infrastructure.internal_api import get as api_get
ctx = await base_context()
# Menu items from coop API (wrapped for attribute access in templates)
menu_data = await api_get("coop", "/internal/menu-items")
ctx["menu_items"] = dictobj(menu_data) if menu_data else []
ctx["menu_items"] = await get_navigation_tree(g.s)
# Cart data from cart API
cart_data = await api_get("cart", "/internal/cart/summary", forward_session=True)

1
glue Submodule

Submodule glue added at f57c765cac