1
0
mirror of git://f0xx.org/ac/ac-ms-graphs synced 2026-07-29 05:18:17 +03:00
This commit is contained in:
Anton Afanasyeu
2026-06-23 12:29:33 +02:00
commit 224dc80d6d
10 changed files with 727 additions and 0 deletions

22
public/api/graphs.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../../src/bootstrap.php';
Auth::check();
$days = (int) ($_GET['days'] ?? 14);
if ($days <= 0) {
$days = 14;
}
try {
$payload = GraphRepository::dashboardData($days);
json_out(['ok' => true, 'data' => $payload]);
} catch (Throwable $e) {
error_log('graphs api: ' . $e->getMessage());
$out = ['ok' => false, 'error' => 'graphs_load_failed'];
if (cfg('debug')) {
$out['hint'] = $e->getMessage();
}
json_out($out, 500);
}