started work on scheduling
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
2026-07-01 10:07:20 +02:00
parent 70dca17451
commit c5c61f22ad
13 changed files with 414 additions and 4 deletions

31
handlers/schedule.php Normal file
View File

@ -0,0 +1,31 @@
<?php
$tokenRec = require_valid_token_web();
require_role(['admin', 'supervisor'], $tokenRec);
if ($method !== 'GET') {
json_error('METHOD_NOT_ALLOWED', 'Method not allowed', 405);
}
try {
$opened = qdb_open_read_or_fail();
[$pdo, $tmpDb, $lockFp] = $opened;
require_once __DIR__ . '/../lib/session_schedule.php';
$entries = qdb_list_session_schedules_scoped($pdo, $tokenRec);
$byDate = [];
foreach ($entries as $entry) {
$date = $entry['scheduledDate'];
$byDate[$date][] = $entry;
}
qdb_discard($tmpDb, $lockFp);
json_success([
'entries' => $entries,
'byDate' => $byDate,
]);
} catch (Throwable $e) {
qdb_handler_fail($e, 'Load schedule', null, $tmpDb ?? null, $lockFp ?? null);
}