Product Variant Images Changed
Image records were created or deleted on a catalog product variant. When that variant is currently on a Design project_product_variants row, Product Marketplace publishes or deletes the matching Supabase objects.
Purpose
Integration event of product-marketplace ProductImage / ProductVariant.
ProductVariantCatalogChanged covers Design catalog display fields on the variant (name, prices, parameters, snapshot imageUrls attachment links, and the rest of the Design snapshot). It is not dispatched for image-record create or delete. This event is that image-set change.
Handlers act only when the variant currently has at least one design-management project_product_variants row (catalogVariantDomainId). Added image records are published with PublishMissingProductImagesUseCase. Removed image records delete {imageRecordId}/original (idempotent with afterAirtableProductImageRecordsDestroyed when the Airtable images row is also destroyed).
Variants that are not on any project keep today’s portal lazy-publish path. Do not eager-publish the whole catalog from this event.
Payload
Envelope is { name, occurredAt, payload } (apps/api-v1/src/modules/shared/domain/events/DomainEvent.ts).
| Field | Type | Meaning |
|---|---|---|
productVariantId | string | Catalog variant whose image set changed (domain_id or Airtable rec, same remap rule as CatalogChanged) |
addedImageRecordIds | string[] | Airtable images record ids created or newly linked to this variant |
removedImageRecordIds | string[] | Airtable images record ids destroyed or unlinked from this variant |
Empty added and empty removed is a no-op; do not dispatch.
Raised by
- The persist path that creates or destroys Airtable
imagesrows (and variant image-link changes) for a product variant, after that persist succeeds. - Not dispatched from image-publish itself (writing
image_urlafter a successful store is not an image-set change).
Consumers
Product-marketplace handler. It asks design-management whether any project_product_variants row exists for this catalog variant, then publishes added ids and deletes store objects for removed ids. Handler failure is logged and does not fail the catalog image write.
Destroying an images row still runs afterAirtableProductImageRecordsDestroyed regardless of project membership. This event does not replace that hook.
Related
- ProjectProductVariantProjected
- ProjectProductVariantReleased
- ProductVariantCatalogChanged
- Code:
apps/api-v1/src/modules/product-marketplace/core/domain/product-variant/ProductVariant.events.ts