Wire real FederationService + add page federation events
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m2s

- Blog app now registers SqlFederationService (was stub/no-op)
- sync_single_page emits post.published/updated events for pages
- Updated shared submodule: fix sign_request in AP delivery handler

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-21 22:52:36 +00:00
parent 346089973f
commit 9d6a458115
3 changed files with 22 additions and 4 deletions

View File

@@ -1066,7 +1066,25 @@ async def sync_single_page(sess: AsyncSession, ghost_id: str) -> None:
tag_obj = await _upsert_tag(sess, pt)
tag_map[pt["id"]] = tag_obj
await _upsert_post(sess, gp, author_map, tag_map)
post = await _upsert_post(sess, gp, author_map, tag_map)
# Emit federation event for published pages
if post.status == "published" and post.user_id:
from shared.events import emit_event
from shared.infrastructure.urls import app_url
event_type = "post.published" if post.created_at == post.updated_at else "post.updated"
await emit_event(
sess,
event_type=event_type,
aggregate_type="Post",
aggregate_id=post.id,
payload={
"user_id": post.user_id,
"title": post.title or "",
"excerpt": post.custom_excerpt or post.excerpt or "",
"url": app_url("coop", f"/{post.slug}/"),
},
)
async def sync_single_author(sess: AsyncSession, ghost_id: str) -> None:

View File

@@ -24,5 +24,5 @@ def register_domain_services() -> None:
if not services.has("cart"):
services.cart = SqlCartService()
if not services.has("federation"):
from shared.services.stubs import StubFederationService
services.federation = StubFederationService()
from shared.services.federation_impl import SqlFederationService
services.federation = SqlFederationService()

2
shared

Submodule shared updated: 1d83a339b6...68941b97f6