From 0a8d1391f6b1bff0434cf6ad550855075a10ae21 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 11 Feb 2026 23:37:54 +0000 Subject: [PATCH] Add glue layer: replace /internal/menu-items API with direct DB query - Context processor: get_navigation_tree() replaces api_get("coop", "/internal/menu-items") - Add glue submodule Co-Authored-By: Claude Opus 4.6 --- .gitmodules | 3 +++ app.py | 9 ++++----- glue | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) create mode 160000 glue diff --git a/.gitmodules b/.gitmodules index b509b5a..9ead19f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/app.py b/app.py index 2b8208d..372e50c 100644 --- a/app.py +++ b/app.py @@ -16,17 +16,16 @@ async def events_context() -> dict: """ Events 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) diff --git a/glue b/glue new file mode 160000 index 0000000..f57c765 --- /dev/null +++ b/glue @@ -0,0 +1 @@ +Subproject commit f57c765cac299b32b66b08c99c2c6a85ca52e0ea