MishkaCmsCore.Activity.Calculations.Severity (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Ash calculation that exposes :severity (atom) on a resource carrying an action name — every paper-trailed version resource, and the event logs the activity timeline draws. Delegates to MishkaCmsCore.Activity.Helpers.severity_for/1 so the same mapping is used in the live broadcast path and in the unified log's SQL.

Wire it from each PaperTrail mixin's calculations block:

calculate :severity, :atom,
          MishkaCmsCore.Activity.Calculations.Severity

:field names the attribute holding the action, for a resource that calls it something other than a version's :version_action_name:

calculate :severity, :atom,
          {MishkaCmsCore.Activity.Calculations.Severity, field: :action}

Summary

Functions

describe(opts)

Callback implementation for Ash.Resource.Calculation.describe/1.

has_calculate?()

has_expression?()

Callback implementation for Ash.Resource.Calculation.has_expression?/0.

load(query, opts, context)

Callback implementation for Ash.Resource.Calculation.load/3.

strict_loads?()

Callback implementation for Ash.Resource.Calculation.strict_loads?/0.