Export context for the Catalogue module.
Drives the Export tab: registry of destinations, item selection, and in-memory file generation. Nothing is persisted to disk.
Usage
destinations = Export.destinations()
items = Export.list_export_items(catalogue_uuids)
{filename, content, mime} = Export.build(%{
destination: :pro100,
format: :furniture,
catalogue_uuids: [uuid1, uuid2]
})
Summary
Functions
Builds the export file in memory.
Finds a destination module by its atom key, or nil if not found.
Returns the list of registered export destination modules.
Each element implements PhoenixKitCatalogue.Export.Destination.
Lists non-deleted items for export across one or more catalogues.
Functions
Builds the export file in memory.
params is a map with keys:
:destination— atom or string destination key (e.g.:pro100or"pro100"):format— atom or string format key (e.g.:furnitureor"furniture"):catalogue_uuids— list of catalogue UUIDs to export:prefix_catalogue— optional; when truthy, PRO100 text formats prefix each item name with its catalogue name ("<catalogue> / <item>"). Default false.
Returns {filename, iodata, mime_type}.
Raises ArgumentError if the destination or format is not recognised, or if
catalogue_uuids is nil/missing.
Finds a destination module by its atom key, or nil if not found.
@spec destinations() :: [module()]
Returns the list of registered export destination modules.
Each element implements PhoenixKitCatalogue.Export.Destination.
@spec list_export_items([Ecto.UUID.t()]) :: [PhoenixKitCatalogue.Schemas.Item.t()]
Lists non-deleted items for export across one or more catalogues.
Returns all active items where catalogue_uuid in ^catalogue_uuids and
status != "deleted", ordered by catalogue, then category position, then
item position, then name. The :catalogue and :category associations are
preloaded on every item.
Returns [] when catalogue_uuids is empty.