MishkaDocument.Resources.Calculations.WorkspaceMaintainers (Mishka Document v0.0.1)

Copy Markdown View Source

Calculates unique maintainers for a workspace based on EventLog.

Maintainers are users who have successfully created or updated:

  • Sections belonging to workspace versions of the workspace
  • Notes belonging to sections of the workspace

Returns a map with:

  • count - number of unique maintainers, at most 100
  • maintainers - list of %{"user_id", "email", "name"}: the 100 who wrote most recently, listed by "name", then "user_id"

"email" is the address when the reader may see it — a master sees everyone's, a site user its own site's — and nil otherwise. "name" is what a screen shows: the email, "Master" for a master, "Unknown" for anyone else (MishkaCmsCore.Accounts.Helper.who/4). Neither which maintainers are listed nor their order depends on an address the reader does not see.

Uses raw SQL for performance with large datasets.

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.

init(opts)

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

load(query, opts, context)

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

strict_loads?()

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