event

Project Product Variant Released

A project_product_variants row was destroyed because no collection on that project still references the catalog variant. Product Marketplace may delete Supabase product-image objects.

EventStatus: Implemented in api-v1

Purpose

Integration event of design-management ProjectProductVariant.

Delete from the project is Design Management. Destroying a collection item so the catalog variant is no longer on any collection for that project runs releaseIfUnreferenced and deletes the Airtable row. Soft-remove from a curated list that re-homes the item onto {projectName}-default does not emit this event.

Supabase product-image objects are catalog-scoped ({imageRecordId}/original), not per-project copies. The Product Marketplace handler deletes those objects and clears images.image_url only when no remaining project_product_variants row uses the same catalogVariantDomainId. Another project still holding the variant keeps the published URLs. Portal list/detail lazy-publish can republish later.

This is not afterAirtableProductImageRecordsDestroyed, which deletes store objects after the catalog images row itself is destroyed.

Payload

Envelope is { name, occurredAt, payload } (apps/api-v1/src/modules/shared/domain/events/DomainEvent.ts).

FieldTypeMeaning
projectIdstringDesign project that no longer holds the row
catalogVariantDomainIdstringProduct Marketplace variant domain_id that was released

No Airtable record ids.

Raised by

  • ForStoringProjectProductVariants.releaseIfUnreferenced after the Airtable delete batch succeeds, once per destroyed row.
  • HTTP: POST /api/v1/design/project-collections/delete when deleteChildren (or item destroy) leaves the variant unreferenced on that project. Compensation after a failed default-collection save on add-variants can take the same port.

Not emitted when releaseIfUnreferenced finds remaining collection references, when the catalog id list is empty, or when no matching row exists.

Consumers

Product-marketplace handler registered on the design-management dispatcher. Last-reference unpublish only. Handler failure is logged and does not fail the Design delete.