BlogEngine.Syndication (blog_engine v0.1.0)

Copy Markdown View Source

Curated, tenant-scoped syndication workflow.

Lock order

All syndication transitions follow the library's canonical lock order — blogs (sorted by id), then the source post, then the placement row — the same global order the post-lifecycle paths in BlogEngine.Posts use (blog before post). Because the source blog id must be known before the blog locks can be taken, each transaction first performs plain non-locking reads of the placement and/or post, acquires the blog and post locks in canonical order, and then re-verifies that the rows still reference the same blogs before proceeding.

Summary

Functions

Approves a requested syndication placement.

Lists one bounded page of requested placements for a tenant target blog.

Rejects a requested placement with a nonblank host-supplied reason.

Requests curated placement of a source post on a target blog.

Creates or reactivates an immediately approved curator-selected placement.

Withdraws an active request or approved placement.

Types

result()

@type result() ::
  {:ok, BlogEngine.Schema.Syndication.t()}
  | {:error, BlogEngine.Error.t() | Ecto.Changeset.t()}

Functions

approve(context, placement_id)

@spec approve(BlogEngine.Context.t(), Ecto.UUID.t()) :: result()

Approves a requested syndication placement.

list_requests(context, target_blog_id, opts \\ [])

Lists one bounded page of requested placements for a tenant target blog.

reject(context, placement_id, reason)

@spec reject(BlogEngine.Context.t(), Ecto.UUID.t(), String.t()) :: result()

Rejects a requested placement with a nonblank host-supplied reason.

request(context, source_post_id, target_blog_id)

@spec request(BlogEngine.Context.t(), Ecto.UUID.t(), Ecto.UUID.t()) :: result()

Requests curated placement of a source post on a target blog.

select(context, source_post_id, target_blog_id)

@spec select(BlogEngine.Context.t(), Ecto.UUID.t(), Ecto.UUID.t()) :: result()

Creates or reactivates an immediately approved curator-selected placement.

withdraw(context, placement_id)

@spec withdraw(BlogEngine.Context.t(), Ecto.UUID.t()) :: result()

Withdraws an active request or approved placement.