Tenant-scoped author commands and reads.
Explicit nil attribute policy
Attribute maps distinguish an absent key from a key whose value is nil.
- An absent key never reaches the changeset.
- An explicit
nilclears the column only for the nullable optional fields[:title, :bio, :avatar_url, :host_identity_type, :host_identity_key]. - An explicit
nilfor any other field — including theNOT NULLdefaulted:activeflag and the required:nameand:slug— is ignored exactly as if the key had been omitted, soactive: nilfalls back to the schema default on create and leaves the stored value alone on update instead of raising aNOT NULLviolation.
Summary
Functions
Creates a tenant-owned author.
Gets an author by tenant-scoped ID.
Gets an author by tenant-scoped slug.
Lists active authors ordered deterministically by name and ID.
Updates an existing tenant-owned author.
Functions
@spec create(BlogEngine.Context.t(), map()) :: {:ok, BlogEngine.Schema.Author.t()} | {:error, BlogEngine.Error.t() | Ecto.Changeset.t()}
Creates a tenant-owned author.
Explicit nil values follow the module's nil policy: they clear only the
nullable optional fields and are otherwise ignored.
@spec get(BlogEngine.Context.t(), Ecto.UUID.t()) :: {:ok, BlogEngine.Schema.Author.t()} | {:error, BlogEngine.Error.t()}
Gets an author by tenant-scoped ID.
@spec get_by_slug(BlogEngine.Context.t(), String.t()) :: {:ok, BlogEngine.Schema.Author.t()} | {:error, BlogEngine.Error.t()}
Gets an author by tenant-scoped slug.
@spec list_active(BlogEngine.Context.t()) :: [BlogEngine.Schema.Author.t()]
Lists active authors ordered deterministically by name and ID.
@spec update(BlogEngine.Context.t(), Ecto.UUID.t(), map()) :: {:ok, BlogEngine.Schema.Author.t()} | {:error, BlogEngine.Error.t() | Ecto.Changeset.t()}
Updates an existing tenant-owned author.
Explicit nil values follow the module's nil policy: they clear only the
nullable optional fields and are otherwise ignored.