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
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:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -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
9
app.py
@@ -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
1
glue
Submodule
Submodule glue added at f57c765cac
Reference in New Issue
Block a user