AccrueAdmin.Queries.Webhooks (accrue_admin v1.5.0)

Copy Markdown View Source

Cursor-paginated webhook event queries for admin ops surfaces.

Summary

Functions

Distinct webhook event types visible in the active owner scope, sorted.

Map of status => count for webhook events in the active owner scope.

Functions

bulk_replay_count(owner_scope, filter)

count(owner_scope, filter \\ %{})

detail(id)

detail(id, owner_scope)

distinct_types(owner_scope)

Distinct webhook event types visible in the active owner scope, sorted.

Post-fetch distinct (after scope_rows/2) keeps owner scoping correct — consistent with count/2 and bulk_replay_count/2. Do NOT push DISTINCT into SQL: ownership is proven per-row in Elixir, not expressible in the base query.

status_counts(owner_scope)

Map of status => count for webhook events in the active owner scope.

Post-fetch frequency (after scope_rows/2), same owner-scoping rationale as distinct_types/1.