Manufacturer ↔ Supplier many-to-many links.
Add and remove individual links via link_*/unlink_*; sync the
full set for one side via sync_*. Bulk syncs run inside a single
transaction and emit one summary activity entry (added + removed
counts).
Public surface is re-exported from PhoenixKitCatalogue.Catalogue.
Summary
Functions
Creates a many-to-many link between a manufacturer and a supplier.
Returns a list of manufacturer UUIDs linked to a supplier.
Returns a list of supplier UUIDs linked to a manufacturer.
Lists all manufacturers linked to a supplier, ordered by name.
Lists all suppliers linked to a manufacturer, ordered by name.
Syncs the supplier links for a manufacturer to match the given list of supplier UUIDs.
Syncs the manufacturer links for a supplier to match the given list of manufacturer UUIDs.
Removes the link between a manufacturer and a supplier.
Functions
@spec link_manufacturer_supplier(Ecto.UUID.t(), Ecto.UUID.t()) :: {:ok, PhoenixKitCatalogue.Schemas.ManufacturerSupplier.t()} | {:error, Ecto.Changeset.t(PhoenixKitCatalogue.Schemas.ManufacturerSupplier.t())}
Creates a many-to-many link between a manufacturer and a supplier.
Returns {:error, changeset} if the link already exists (unique constraint).
@spec linked_manufacturer_uuids(Ecto.UUID.t()) :: [Ecto.UUID.t()]
Returns a list of manufacturer UUIDs linked to a supplier.
@spec linked_supplier_uuids(Ecto.UUID.t()) :: [Ecto.UUID.t()]
Returns a list of supplier UUIDs linked to a manufacturer.
@spec list_manufacturers_for_supplier(Ecto.UUID.t()) :: [ PhoenixKitCatalogue.Schemas.Manufacturer.t() ]
Lists all manufacturers linked to a supplier, ordered by name.
@spec list_suppliers_for_manufacturer(Ecto.UUID.t()) :: [ PhoenixKitCatalogue.Schemas.Supplier.t() ]
Lists all suppliers linked to a manufacturer, ordered by name.
@spec sync_manufacturer_suppliers(Ecto.UUID.t(), [Ecto.UUID.t()], keyword()) :: {:ok, :synced} | {:error, term()}
Syncs the supplier links for a manufacturer to match the given list of supplier UUIDs.
Adds missing links and removes extra ones via set difference.
Returns {:ok, :synced} on success or {:error, reason} on the first failure.
@spec sync_supplier_manufacturers(Ecto.UUID.t(), [Ecto.UUID.t()], keyword()) :: {:ok, :synced} | {:error, term()}
Syncs the manufacturer links for a supplier to match the given list of manufacturer UUIDs.
Adds missing links and removes extra ones via set difference.
Returns {:ok, :synced} on success or {:error, reason} on the first failure.
@spec unlink_manufacturer_supplier(Ecto.UUID.t(), Ecto.UUID.t()) :: {:ok, PhoenixKitCatalogue.Schemas.ManufacturerSupplier.t()} | {:error, :not_found | Ecto.Changeset.t(PhoenixKitCatalogue.Schemas.ManufacturerSupplier.t())}
Removes the link between a manufacturer and a supplier.
Returns {:error, :not_found} if the link doesn't exist.