PhoenixKitCatalogue.Catalogue.Suppliers (PhoenixKitCatalogue v0.1.14)

Copy Markdown View Source

Suppliers — delivery companies linked to manufacturers via the many-to-many phoenix_kit_cat_manufacturer_suppliers table.

Same lifecycle as manufacturers: hard-delete only, "active" / "inactive" status.

Public surface is re-exported from PhoenixKitCatalogue.Catalogue.

Summary

Functions

Returns a changeset for tracking supplier changes.

Hard-deletes a supplier from the database.

Fetches a supplier by UUID. Returns nil if not found.

Fetches a supplier by UUID. Raises Ecto.NoResultsError if not found.

Lists all suppliers, ordered by name.

Updates a supplier with the given attributes.

Functions

change_supplier(supplier, attrs \\ %{})

Returns a changeset for tracking supplier changes.

create_supplier(attrs, opts \\ [])

Creates a supplier.

Required attributes

  • :name — supplier name (1-255 chars)

Optional attributes

  • :description, :website, :contact_info, :notes
  • :status"active" (default) or "inactive"
  • :data — flexible JSON map

delete_supplier(supplier, opts \\ [])

Hard-deletes a supplier from the database.

get_supplier(uuid)

@spec get_supplier(Ecto.UUID.t()) :: PhoenixKitCatalogue.Schemas.Supplier.t() | nil

Fetches a supplier by UUID. Returns nil if not found.

get_supplier!(uuid)

Fetches a supplier by UUID. Raises Ecto.NoResultsError if not found.

list_suppliers(opts \\ [])

@spec list_suppliers(keyword()) :: [PhoenixKitCatalogue.Schemas.Supplier.t()]

Lists all suppliers, ordered by name.

Options

  • :status — filter by status (e.g. "active", "inactive").

update_supplier(supplier, attrs, opts \\ [])

Updates a supplier with the given attributes.