Context for managing OpenGraph templates. CRUD only — the editor and renderer live elsewhere.
Mutating functions accept an opts keyword list; pass actor_uuid: user_uuid to attribute the change in the activity feed. Omitting it
logs an anonymous entry — still auditable, just not attributed.
Summary
Functions
Deletes a template. The foreign key cascades to every assignment that
uses it, so each of those leaves its own assignment.deleted row
(metadata "cascade" => "template.deleted"), written in the same
transaction as the delete: the audit trail names exactly the assignments
that went with it, or nothing at all when the delete rolls back.
Returns nil when no template matches.
Returns all templates, ordered by name.
Functions
@spec change(PhoenixKitOG.Schemas.Template.t(), map()) :: Ecto.Changeset.t()
@spec create(map(), keyword()) :: {:ok, PhoenixKitOG.Schemas.Template.t()} | {:error, Ecto.Changeset.t()}
@spec delete(PhoenixKitOG.Schemas.Template.t(), keyword()) :: {:ok, PhoenixKitOG.Schemas.Template.t()} | {:error, Ecto.Changeset.t() | :not_found}
Deletes a template. The foreign key cascades to every assignment that
uses it, so each of those leaves its own assignment.deleted row
(metadata "cascade" => "template.deleted"), written in the same
transaction as the delete: the audit trail names exactly the assignments
that went with it, or nothing at all when the delete rolls back.
@spec get(binary()) :: PhoenixKitOG.Schemas.Template.t() | nil
Returns nil when no template matches.
@spec list() :: [PhoenixKitOG.Schemas.Template.t()]
Returns all templates, ordered by name.
@spec update(PhoenixKitOG.Schemas.Template.t(), map(), keyword()) :: {:ok, PhoenixKitOG.Schemas.Template.t()} | {:error, Ecto.Changeset.t()}