PhoenixKitCatalogue.Catalogue.Manufacturers (PhoenixKitCatalogue v0.1.14)

Copy Markdown View Source

Manufacturers — company directory used as the source of items.

Hard-deletes only (manufacturers are reference data, not user content). Status field is "active" / "inactive"; inactive manufacturers remain in the DB but are filtered from item dropdowns.

Public surface is re-exported from PhoenixKitCatalogue.Catalogue via defdelegate, so callers can keep using the canonical context module.

Summary

Functions

Returns a changeset for tracking manufacturer changes.

Creates a manufacturer.

Hard-deletes a manufacturer from the database.

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

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

Lists all manufacturers, ordered by name.

Updates a manufacturer with the given attributes.

Functions

change_manufacturer(manufacturer, attrs \\ %{})

Returns a changeset for tracking manufacturer changes.

create_manufacturer(attrs, opts \\ [])

Creates a manufacturer.

Required attributes

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

Optional attributes

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

delete_manufacturer(manufacturer, opts \\ [])

Hard-deletes a manufacturer from the database.

get_manufacturer(uuid)

@spec get_manufacturer(Ecto.UUID.t()) ::
  PhoenixKitCatalogue.Schemas.Manufacturer.t() | nil

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

get_manufacturer!(uuid)

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

list_manufacturers(opts \\ [])

@spec list_manufacturers(keyword()) :: [PhoenixKitCatalogue.Schemas.Manufacturer.t()]

Lists all manufacturers, ordered by name.

Options

  • :status — filter by status (e.g. "active", "inactive"). When nil (default), returns all manufacturers.

update_manufacturer(manufacturer, attrs, opts \\ [])

Updates a manufacturer with the given attributes.