The categories of the news (Tayori.Category), in their order. The
admin manages them; a script or a seed can too:
{:ok, _} = Tayori.Categories.create(%{"names" => %{"en" => "New"}, "color" => "blue"})
Summary
Functions
The categories by key, for rendering entries.
A changeset of a category, for a form.
Creates a category, at the end of the list.
Deletes a category, and takes it off the entries that have it.
A category by its key, or nil.
The categories, in their order.
Puts the categories in the order of the keys given.
Updates a category's names and colour. Its key stays.
Functions
@spec by_key() :: %{required(String.t()) => Tayori.Category.t()}
The categories by key, for rendering entries.
@spec change(Tayori.Category.t(), map()) :: Ecto.Changeset.t()
A changeset of a category, for a form.
@spec create(map()) :: {:ok, Tayori.Category.t()} | {:error, Ecto.Changeset.t()}
Creates a category, at the end of the list.
@spec delete(Tayori.Category.t()) :: {:ok, Tayori.Category.t()} | {:error, Ecto.Changeset.t()}
Deletes a category, and takes it off the entries that have it.
@spec get(String.t()) :: Tayori.Category.t() | nil
A category by its key, or nil.
@spec list() :: [Tayori.Category.t()]
The categories, in their order.
@spec reorder([String.t()]) :: :ok
Puts the categories in the order of the keys given.
@spec update(Tayori.Category.t(), map()) :: {:ok, Tayori.Category.t()} | {:error, Ecto.Changeset.t()}
Updates a category's names and colour. Its key stays.