You've already forked tribes-plugin-kobold
f050f58e85
CI / Test (push) Failing after 16s
Model dynamic dataset edits as synced commit chunks with bookmarks while keeping record projections as the local read model.\n\nPrivate/public visibility now only controls external tribe access; dataset metadata, resource definitions, and commits still publish through AshNostrSync for cluster-wide distribution.
27 lines
612 B
Elixir
27 lines
612 B
Elixir
defmodule TribeOne.TribesPlugin.Kobold.Changes.ProjectCommit do
|
|
@moduledoc false
|
|
|
|
use Ash.Resource.Change
|
|
|
|
alias TribeOne.TribesPlugin.Kobold.Projector
|
|
|
|
@impl true
|
|
def change(changeset, _opts, _context) do
|
|
Ash.Changeset.after_transaction(changeset, fn _changeset, result ->
|
|
case result do
|
|
{:ok, commit} ->
|
|
case Projector.apply_commit(commit) do
|
|
{:ok, _count} -> result
|
|
{:error, reason} -> {:error, reason}
|
|
end
|
|
|
|
_other ->
|
|
result
|
|
end
|
|
end)
|
|
end
|
|
|
|
@impl true
|
|
def atomic(_changeset, _opts, _context), do: :ok
|
|
end
|