Inline federation publication for products
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m0s

Replace emit_event("product.listed") with direct try_publish().
Update shared submodule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-22 07:55:57 +00:00
parent c05e6e5baa
commit 4671bc616e
2 changed files with 12 additions and 10 deletions

View File

@@ -292,17 +292,19 @@ async def _create_product_from_payload(session: AsyncSession, payload: Dict[str,
_replace_children(p, payload)
await session.flush()
# Emit federation event for new products
from shared.events import emit_event
await emit_event(
# Publish to federation inline
from shared.services.federation_publish import try_publish
await try_publish(
session,
event_type="product.listed",
aggregate_type="Product",
aggregate_id=p.id,
payload={
"title": p.title or "",
"description": getattr(p, "description", "") or "",
user_id=getattr(p, "user_id", None),
activity_type="Create",
object_type="Object",
object_data={
"name": p.title or "",
"summary": getattr(p, "description", "") or "",
},
source_type="Product",
source_id=p.id,
)
return p