Inline federation publication for products
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m0s
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:
@@ -292,17 +292,19 @@ async def _create_product_from_payload(session: AsyncSession, payload: Dict[str,
|
|||||||
_replace_children(p, payload)
|
_replace_children(p, payload)
|
||||||
await session.flush()
|
await session.flush()
|
||||||
|
|
||||||
# Emit federation event for new products
|
# Publish to federation inline
|
||||||
from shared.events import emit_event
|
from shared.services.federation_publish import try_publish
|
||||||
await emit_event(
|
await try_publish(
|
||||||
session,
|
session,
|
||||||
event_type="product.listed",
|
user_id=getattr(p, "user_id", None),
|
||||||
aggregate_type="Product",
|
activity_type="Create",
|
||||||
aggregate_id=p.id,
|
object_type="Object",
|
||||||
payload={
|
object_data={
|
||||||
"title": p.title or "",
|
"name": p.title or "",
|
||||||
"description": getattr(p, "description", "") or "",
|
"summary": getattr(p, "description", "") or "",
|
||||||
},
|
},
|
||||||
|
source_type="Product",
|
||||||
|
source_id=p.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
return p
|
return p
|
||||||
|
|||||||
2
shared
2
shared
Submodule shared updated: 18410c4b16...3bde451ce9
Reference in New Issue
Block a user