Files
self f050f58e85
CI / Test (push) Failing after 16s
feat: add Kobold commit chunks
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.
2026-05-29 01:22:47 +02:00

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