Add cancel snooze

- Add common request validation function
This commit is contained in:
2024-06-23 06:58:47 -04:00
parent d6e8cf66cc
commit 9421bb2035
11 changed files with 96 additions and 83 deletions

View File

@@ -1,15 +1,11 @@
<?php declare(strict_types=1);
use MyPrayerJournal\{Auth, Request, Table, UI};
use MyPrayerJournal\{Table, UI};
use BitBadger\PDODocument\Patch;
require '../../start.php';
if ($_SERVER['REQUEST_METHOD'] <> 'PATCH') not_found();
Auth::requireUser(false);
$req = Request::byId($_GET['id']);
if (!$req) not_found();
$req = validate_request($_GET['id'], ['PATCH'], false);
$until = (new DateTimeImmutable($_PATCH['until'] . 'T00:00:00', new DateTimeZone($_REQUEST['time_zone'])))
->setTimezone(new DateTimeZone('Etc/UTC'));