MishkaDocument.Resources.Changes.SetEventMetadata (Mishka Document v0.0.1)

Copy Markdown View Source

Sets event metadata for activity log tracking.

This change adds workspace_id, workspace_version_id, section_id, and other relevant metadata to the changeset context for AshEvents tracking.

Options

  • :resource_type - The type of resource (required):

    • :section - workspace_version_id is on the record
    • :note - section_id is on the record, traces through section
    • :section_draft - workspace_version_id on record, uses source_section_id
    • :note_draft - workspace_version_id and section_id on record
  • :for_action - The action type (optional, defaults to :update):

    • :create - Uses changeset attributes
    • :update / :destroy - Uses changeset.data

Usage

change {MishkaDocument.Resources.Changes.SetEventMetadata,
        resource_type: :section, for_action: :create}

change {MishkaDocument.Resources.Changes.SetEventMetadata,
        resource_type: :note, for_action: :update}