PhoenixKitStaff.Activity (PhoenixKitStaff v0.2.0)

Copy Markdown View Source

Thin wrapper around PhoenixKit.Activity.log/1 so callers don't need to duplicate the Code.ensure_loaded?/1 guard and rescue clause everywhere. Safe to call from any LiveView — never crashes the caller.

Summary

Functions

Extracts user.uuid from the LiveView socket assigns.

Logs a staff activity entry via PhoenixKit.Activity. Swallows errors so it never crashes the caller.

Functions

actor_uuid(socket)

@spec actor_uuid(Phoenix.LiveView.Socket.t()) :: UUIDv7.t() | String.t() | nil

Extracts user.uuid from the LiveView socket assigns.

log(action, opts)

@spec log(
  String.t(),
  keyword()
) :: :ok | :activity_unavailable | {:ok, struct()} | {:error, any()}

Logs a staff activity entry via PhoenixKit.Activity. Swallows errors so it never crashes the caller.