Add glue layer support: MenuNode templates, factory registration, migration

- Templates: item.post.X → item.X (MenuNode has label/slug/feature_image directly)
- factory.py: add glue.models to import loop + register_glue_handlers() at startup
- alembic env.py: add glue.models to import loop
- New migration: container_relations + menu_nodes tables with backfill from existing data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-11 23:37:35 +00:00
parent e1e6a7a98b
commit 2c4ab9e3c8
7 changed files with 129 additions and 26 deletions

View File

@@ -11,7 +11,7 @@ from shared.config import init_config, config, pretty
from shared.models import KV # ensure shared models imported
# Register all app model classes with SQLAlchemy so cross-domain
# relationship() string references resolve correctly.
for _mod in ("blog.models", "market.models", "cart.models", "events.models"):
for _mod in ("blog.models", "market.models", "cart.models", "events.models", "glue.models"):
try:
__import__(_mod)
except ImportError:
@@ -144,6 +144,11 @@ def create_base_app(
# --- startup ---
@app.before_serving
async def _startup():
try:
from glue.setup import register_glue_handlers
register_glue_handlers()
except ImportError:
pass # glue submodule not present in this build context
await init_config()
print(pretty())
await _event_processor.start()