Related Product Added
A ProductAccessory link was recorded. Design-management refreshes existing project product rows; it never creates a row from this event.
Purpose
Integration event of product-marketplace ProductAccessory. A steward linked one product variant to another as a required or optional accessory.
This is not ProductVariantCatalogChanged — the variant aggregate did not change.
Thin payload + read-back (hex §7 deviation, D9). The handler re-reads the source variant’s current snapshot (including relatedProducts) rather than trusting field values on the event.
Payload
Envelope is { name, occurredAt, payload } (apps/api-v1/src/modules/shared/domain/events/DomainEvent.ts).
| Field | Type | Meaning |
|---|---|---|
productAccessoryId | string | Accessory aggregate domain_id |
sourceProductVariantId | string | Marketplace variant that received the accessory |
accessoryProductVariantId | string | Marketplace variant linked as the accessory |
accessoryType | string | required or optional |
Raised by
ProductAccessory.linkrecords the event;AddRelatedProductUseCasedrainspullDomainEventsand dispatches after save.- HTTP:
POST /api/v1/product-marketplace/product-variants/actions/add-related-product
Not emitted when link fails (self-link, missing ids, invalid type). Removal of a related_products row is out of scope for this event.
Consumers
RefreshProjectProductVariantsOnRelatedProductAddedHandler in design-management. Refreshes existing ProjectProductVariant rows for the source variant only. Never creates rows (accessories not on the project are omitted).
Idempotency key: handler + productAccessoryId + occurredAt. In-memory store. No outbox; dispatch is best-effort in-process.
Related
- ProductVariantCatalogChanged
- Product Marketplace
- Design Management
- Code:
apps/api-v1/src/modules/product-marketplace/core/domain/product-accessory/ProductAccessory.events.ts