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,16 +1,11 @@
<?php declare(strict_types=1);
use MyPrayerJournal\{Auth, History, RecurrencePeriod, Request, RequestAction, Table, UI};
use MyPrayerJournal\{History, RecurrencePeriod, RequestAction, 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);
$now = new DateTimeImmutable('now');
array_unshift($req->history, new History($now->format('c'), RequestAction::Prayed));