API / Minn\Admin / OverviewController

OverviewController final readonly class

Minn\Admin\OverviewController · public/minn/src/Minn/Admin/OverviewController.php · 140 lines

The Overview of minn-admin/v1: the payload, the drill-down behind one chart bar, and the pick of cards, the person's own and the site's default.

Used by 1

Constants and properties

privatereadonly Minn\Db $db

Promoted from the constructor.

privatereadonly Minn\Content\Site $site

Promoted from the constructor.

privatereadonly Minn\Admin\Dashboard $dashboard

Promoted from the constructor.

privatereadonly Minn\Content\Users $users

Promoted from the constructor.

privatereadonly Minn\Rest\Caller $caller

Promoted from the constructor.

Public

new__construct(Minn\Db $db, Minn\Content\Site $site, Minn\Admin\Dashboard $dashboard, Minn\Content\Users $users, Minn\Rest\Caller $caller)#
methodoverview(Minn\Http\Request $request): Minn\Http\ResponseGET /minn-admin/v1/overview (floor edit_posts)#

The overview payload.

methodoverviewActivity(Minn\Http\Request $request): Minn\Http\ResponseGET /minn-admin/v1/overview/activity (floor edit_posts)#

The events behind one chart bar.

methodsetOverviewMetrics(Minn\Http\Request $request): Minn\Http\ResponsePOST /minn-admin/v1/overview/metrics (floor edit_posts)#

Saves the caller's pick of overview cards.

methodsetOverviewMetricDefaults(Minn\Http\Request $request): Minn\Http\ResponsePOST /minn-admin/v1/overview/metric-defaults (floor edit_posts + manage_options)#

Saves the site's default overview cards.

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatemetricKeysFrom(Minn\Http\Request $request): ?array#

The cleaned keys, null when the caller asked for a clear; a missing or non-list keys member refuses.

privatestoredMetricLayout(int $userId): array#

The stored layout, unfiltered by the catalog, so a save answers without a second Overview round trip.

privatedays(Minn\Http\Request $request): int#

?days must be an in-range integer; the reference's parameter errors otherwise.

privatewindow(Minn\Http\Request $request): array#

Both bounds required, "Y-m-d H:i:s". @return array{0: string, 1: string}

@return array{0: string, 1: string}
privateparameterError(string $param, string $code, string $message, mixed $data): Minn\RestError#