31 lines
852 B
PHP
31 lines
852 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/includes/okr_app.php';
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
try {
|
|
okr_require_schema();
|
|
$entries = okr_fetch_entries();
|
|
$metrics = okr_dashboard_metrics($entries);
|
|
$notifications = okr_collect_notifications($entries, 8);
|
|
|
|
echo json_encode([
|
|
'success' => true,
|
|
'notifications' => $notifications,
|
|
'counts' => [
|
|
'total' => $metrics['total'],
|
|
'draft' => $metrics['draft'],
|
|
'pending' => $metrics['pending'],
|
|
'approved' => $metrics['approved'],
|
|
],
|
|
], JSON_UNESCAPED_UNICODE);
|
|
} catch (Throwable $exception) {
|
|
http_response_code(500);
|
|
echo json_encode([
|
|
'success' => false,
|
|
'error' => 'Unable to load activity feed.',
|
|
], JSON_UNESCAPED_UNICODE);
|
|
}
|