event

Related Product Added

A ProductAccessory link was recorded. Design-management refreshes existing project product rows; it never creates a row from this event.

EventStatus: Implemented in api-v1

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).

FieldTypeMeaning
productAccessoryIdstringAccessory aggregate domain_id
sourceProductVariantIdstringMarketplace variant that received the accessory
accessoryProductVariantIdstringMarketplace variant linked as the accessory
accessoryTypestringrequired or optional

Raised by

  • ProductAccessory.link records the event; AddRelatedProductUseCase drains pullDomainEvents and 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.