BlogEngine.Routing (blog_engine v0.1.0)

Copy Markdown View Source

Tenant-scoped route reservations, history, template moves, and resolution.

Summary

Types

An exact route or a path prefix including that path and all descendants.

Functions

Changes a blog's route templates and every route it owns in one transaction.

Adds a trusted, namespaced blog-template move to a host-owned Multi.

Returns paginated tenant-scoped facts about exact or prefix route reservations.

Promotes a post path to current and preserves the previous canonical path as former.

Releases the draft reservation for a never-published post inside its deletion Multi.

Reserves or replaces a post's draft path inside an owning lifecycle Multi.

Resolves a current route or a former redirect without exposing private content.

Lists a blog or post owner's routes in deterministic lifecycle order.

Types

reservation_query()

@type reservation_query() :: {:exact, String.t()} | {:prefix, String.t()}

An exact route or a path prefix including that path and all descendants.

Functions

change_blog_templates(context, blog_id, attrs)

@spec change_blog_templates(BlogEngine.Context.t(), Ecto.UUID.t(), map()) ::
  {:ok, BlogEngine.Schema.Blog.t()}
  | {:error, BlogEngine.Error.t() | Ecto.Changeset.t()}

Changes a blog's route templates and every route it owns in one transaction.

change_blog_templates_multi(multi, context, operation_name, blog_id, attrs)

@spec change_blog_templates_multi(
  Ecto.Multi.t(),
  BlogEngine.Context.t(),
  term(),
  Ecto.UUID.t(),
  map()
) ::
  Ecto.Multi.t()

Adds a trusted, namespaced blog-template move to a host-owned Multi.

list_reservations(context, query, opts)

Returns paginated tenant-scoped facts about exact or prefix route reservations.

publish_post_multi(multi, context, namespace, blog, post, revision)

Promotes a post path to current and preserves the previous canonical path as former.

release_never_published_draft_multi(multi, context, namespace, post)

@spec release_never_published_draft_multi(
  Ecto.Multi.t(),
  BlogEngine.Context.t(),
  term(),
  BlogEngine.Schema.Post.t() | atom() | (map() -> BlogEngine.Schema.Post.t())
) :: Ecto.Multi.t()

Releases the draft reservation for a never-published post inside its deletion Multi.

reserve_post_draft_multi(multi, context, namespace, blog, post, revision)

Reserves or replaces a post's draft path inside an owning lifecycle Multi.

resolve(context, path)

@spec resolve(BlogEngine.Context.t(), String.t()) ::
  {:ok, map()} | {:redirect, String.t()} | :not_found

Resolves a current route or a former redirect without exposing private content.

routes_for(context, owner_id)

Lists a blog or post owner's routes in deterministic lifecycle order.