Decouple blog UI via widget registry
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 54s

Replace explicit calendar/market service calls in post routes, auth
routes, and listing cards with widget-driven iteration. Zero cross-domain
imports remain in blog bp layer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-19 18:04:26 +00:00
parent bb60835c58
commit 8af7c69090
3 changed files with 51 additions and 69 deletions

View File

@@ -1,7 +1,7 @@
from ..ghost_db import DBClient # adjust import path
from sqlalchemy import select
from models.ghost_content import PostLike
from shared.services.registry import services
from shared.services.widget_registry import widgets
from quart import g
async def posts_data(
@@ -85,12 +85,11 @@ async def posts_data(
for post in posts:
post["is_liked"] = False
# Fetch associated entries for each post via calendar service
entries_by_post = await services.calendar.confirmed_entries_for_posts(session, post_ids)
# Add associated_entries to each post
for post in posts:
post["associated_entries"] = entries_by_post.get(post["id"], [])
# Widget-driven card decoration
for w in widgets.container_cards:
batch_data = await w.batch_fn(session, post_ids)
for post in posts:
post[w.context_key] = batch_data.get(post["id"], [])
tags=await client.list_tags(
limit=50000