MishkaDocument.Resources.Helpers.VersionClones (Mishka Document v0.0.1)

Copy Markdown View Source

The versions cloned from a version, and from those, however deep: every version whose source_version_id leads back to it. Deleting a version deletes them with it (MishkaDocument.Resources.Changes.DestroyClones); its delete confirmation names them (MishkaDocument.Resources.Calculations.CloneNumbers).

Read as the caller, under each version's own site, one read a generation.

VersionClones.of([version], actor: actor, authorize?: true)
#=> {:ok, %{version.id => [%WorkspaceVersion{version_number: "0.0.10"}, …]}}

Summary

Functions

The options a write or read made for a caller is run with: its actor and authorization, and the shared context it came with — the admin surface its permissions are asked on among it — taken from the context of the change or calculation running (context) and of the changeset or query around it (source_context).

Each of versions' clones, nearest first, keyed by the version's id. opts are the caller's :actor and :authorize?.

Functions

as_caller(context, source_context)

@spec as_caller(map(), map()) :: keyword()

The options a write or read made for a caller is run with: its actor and authorization, and the shared context it came with — the admin surface its permissions are asked on among it — taken from the context of the change or calculation running (context) and of the changeset or query around it (source_context).

of(versions, opts)

@spec of([map()], keyword()) ::
  {:ok, %{required(String.t()) => [map()]}} | {:error, term()}

Each of versions' clones, nearest first, keyed by the version's id. opts are the caller's :actor and :authorize?.