Compare commits
4 Commits
e121701250
...
4.0.0-alph
| Author | SHA1 | Date | |
|---|---|---|---|
| ff34bb9743 | |||
| 61127676a2 | |||
| 5beeee4819 | |||
| a2feaff4da |
255
.gitignore
vendored
255
.gitignore
vendored
@@ -1,262 +1,7 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
.vscode/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# Ionide VSCode extension
|
||||
.ionide
|
||||
|
||||
src/environment.txt
|
||||
|
||||
# PHP ignore files
|
||||
src/vendor
|
||||
src/.env
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/snap/bin/pwsh
|
||||
Set-Location src/MyPrayerJournal
|
||||
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained false --nologo
|
||||
@@ -6,7 +6,6 @@
|
||||
"ext-pdo": "*",
|
||||
"ext-sqlite3": "*",
|
||||
"bit-badger/pdo-document": "^1",
|
||||
"visus/cuid2": "^4",
|
||||
"guzzlehttp/guzzle": "^7.8",
|
||||
"guzzlehttp/psr7": "^2.6",
|
||||
"http-interop/http-factory-guzzle": "^1.2",
|
||||
|
||||
72
src/composer.lock
generated
72
src/composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d19a824cbca9da75d5b5dafbc9fa1367",
|
||||
"content-hash": "d03cca0e9df6892b1154d46aa43ddfe9",
|
||||
"packages": [
|
||||
{
|
||||
"name": "auth0/auth0-php",
|
||||
@@ -107,16 +107,17 @@
|
||||
},
|
||||
{
|
||||
"name": "bit-badger/pdo-document",
|
||||
"version": "v1.0.0-beta1",
|
||||
"version": "v1.0.0-beta2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://git.bitbadger.solutions/bit-badger/pdo-document",
|
||||
"reference": "124426fa12069aa93e75f7e2946eb2c5ff83a591"
|
||||
"reference": "50854275a8b39074966cf00370f30b3e68edc6e7"
|
||||
},
|
||||
"require": {
|
||||
"ext-pdo": "*",
|
||||
"netresearch/jsonmapper": "^4",
|
||||
"php": ">=8.2"
|
||||
"php": ">=8.2",
|
||||
"phpoption/phpoption": "^1.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^11"
|
||||
@@ -141,11 +142,12 @@
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Treat SQLite (and soon PostgreSQL) as a document store",
|
||||
"description": "Treat SQLite and PostgreSQL as document stores",
|
||||
"keywords": [
|
||||
"database",
|
||||
"document",
|
||||
"pdo",
|
||||
"postgresql",
|
||||
"sqlite"
|
||||
],
|
||||
"support": {
|
||||
@@ -153,7 +155,7 @@
|
||||
"rss": "https://git.bitbadger.solutions/bit-badger/pdo-document.rss",
|
||||
"source": "https://git.bitbadger.solutions/bit-badger/pdo-document"
|
||||
},
|
||||
"time": "2024-06-21T13:46:41+00:00"
|
||||
"time": "2024-06-25T14:42:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/semver",
|
||||
@@ -2244,64 +2246,6 @@
|
||||
],
|
||||
"time": "2024-05-31T15:07:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "visus/cuid2",
|
||||
"version": "4.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/visus-io/php-cuid2.git",
|
||||
"reference": "17c9b3098d556bb2556a084c948211333cc19c79"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/visus-io/php-cuid2/zipball/17c9b3098d556bb2556a084c948211333cc19c79",
|
||||
"reference": "17c9b3098d556bb2556a084c948211333cc19c79",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"ergebnis/composer-normalize": "^2.29",
|
||||
"ext-ctype": "*",
|
||||
"phpstan/phpstan": "^1.9",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"squizlabs/php_codesniffer": "^3.7",
|
||||
"vimeo/psalm": "^5.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gmp": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/compat.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Visus\\Cuid2\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alan Brault",
|
||||
"email": "alan.brault@visus.io"
|
||||
}
|
||||
],
|
||||
"description": "A PHP library for generating collision-resistant ids (CUIDs).",
|
||||
"keywords": [
|
||||
"cuid",
|
||||
"identifier"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/visus-io/php-cuid2/issues",
|
||||
"source": "https://github.com/visus-io/php-cuid2/tree/4.1.0"
|
||||
},
|
||||
"time": "2024-05-14T13:23:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
"version": "v5.6.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use BitBadger\PDODocument\{Configuration, Custom, Definition, Document, Mode};
|
||||
use BitBadger\PDODocument\{AutoId, Configuration, Custom, Definition, Document, Mode};
|
||||
use BitBadger\PDODocument\Mapper\ArrayMapper;
|
||||
use MyPrayerJournal\Domain\{History, Note, Recurrence, RecurrencePeriod, Request, RequestAction};
|
||||
use MyPrayerJournal\Table;
|
||||
@@ -16,8 +16,10 @@ $reqs = Custom::array('SELECT data FROM mpj.request', [], new ArrayMapper());
|
||||
echo 'Found ' . sizeof($reqs) . ' requests; migrating to v4...' . PHP_EOL;
|
||||
|
||||
Configuration::resetPDO();
|
||||
Configuration::$mode = Mode::SQLite;
|
||||
Configuration::$pdoDSN = 'sqlite:./data/mpj.db';
|
||||
Configuration::$mode = Mode::SQLite;
|
||||
Configuration::$pdoDSN = 'sqlite:./data/mpj.db';
|
||||
Configuration::$autoId = AutoId::RandomString;
|
||||
Configuration::$idStringLength = 12;
|
||||
|
||||
Definition::ensureTable(Table::REQUEST);
|
||||
|
||||
@@ -28,30 +30,27 @@ function convertDate(string $date): string
|
||||
}
|
||||
|
||||
foreach ($reqs as $reqJson) {
|
||||
$req = json_decode($reqJson['data']);
|
||||
$notes = array_map(fn(stdClass $note) => new Note(convertDate($note->asOf), $note->notes), $req->notes ?? []);
|
||||
$history = array_map(fn(stdClass $hist) =>
|
||||
new History(
|
||||
asOf: convertDate($hist->asOf),
|
||||
action: RequestAction::from($hist->status),
|
||||
text: property_exists($hist, 'text') ? $hist->text : null),
|
||||
$req->history);
|
||||
$req = json_decode($reqJson['data']);
|
||||
$recurParts = explode(' ', $req->recurrence);
|
||||
$recurPeriod = RecurrencePeriod::from(end($recurParts));
|
||||
$recur = match ($recurPeriod) {
|
||||
RecurrencePeriod::Immediate => new Recurrence(RecurrencePeriod::Immediate),
|
||||
default => new Recurrence($recurPeriod, (int)$recurParts[0])
|
||||
};
|
||||
$v4Req = new Request(
|
||||
id: $req->id,
|
||||
Document::insert(Table::REQUEST, new Request(
|
||||
enteredOn: convertDate($req->enteredOn),
|
||||
userId: $req->userId,
|
||||
snoozedUntil: property_exists($req, 'snoozedUntil') ? convertDate($req->snoozedUntil) : null,
|
||||
showAfter: property_exists($req, 'showAfter') ? convertDate($req->showAfter) : null,
|
||||
recurrence: $recur,
|
||||
history: $history,
|
||||
notes: $notes);
|
||||
Document::insert(Table::REQUEST, $v4Req);
|
||||
history: array_map(fn(stdClass $hist) =>
|
||||
new History(
|
||||
asOf: convertDate($hist->asOf),
|
||||
action: RequestAction::from($hist->status),
|
||||
text: property_exists($hist, 'text') ? $hist->text : null),
|
||||
$req->history),
|
||||
notes: array_map(fn(stdClass $note) =>
|
||||
new Note(convertDate($note->asOf), $note->notes), $req->notes ?? [])));
|
||||
}
|
||||
|
||||
echo PHP_EOL . 'done' . PHP_EOL;
|
||||
|
||||
@@ -25,6 +25,6 @@ class Note
|
||||
public static function byRequestId(string $id): array
|
||||
{
|
||||
$req = Request::byId($id);
|
||||
return $req ? $req->notes : [];
|
||||
return $req->isDefined() ? $req->get()->notes : [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace MyPrayerJournal\Domain;
|
||||
|
||||
use BitBadger\PDODocument\{Custom, DocumentException, DocumentList, Find, Mapper\DocumentMapper};
|
||||
use BitBadger\PDODocument\{Custom, DocumentException, DocumentList, Find};
|
||||
use BitBadger\PDODocument\Mapper\DocumentMapper;
|
||||
use DateTimeImmutable;
|
||||
use Exception;
|
||||
use JsonSerializable;
|
||||
use MyPrayerJournal\Table;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
use PhpOption\{None, Option};
|
||||
|
||||
/**
|
||||
* A prayer request
|
||||
@@ -28,12 +29,7 @@ class Request implements JsonSerializable
|
||||
public function __construct(public string $id = '', public string $enteredOn = '', public string $userId = '',
|
||||
public ?string $snoozedUntil = null, public ?string $showAfter = null,
|
||||
public Recurrence $recurrence = new Recurrence(RecurrencePeriod::Immediate),
|
||||
public array $history = [], public array $notes = [])
|
||||
{
|
||||
if ($id == '') {
|
||||
$this->id = (new Cuid2())->toString();
|
||||
}
|
||||
}
|
||||
public array $history = [], public array $notes = []) { }
|
||||
|
||||
/**
|
||||
* Get the current text for this request
|
||||
@@ -110,13 +106,13 @@ class Request implements JsonSerializable
|
||||
* Find a request by its ID
|
||||
*
|
||||
* @param string $id The ID of the request
|
||||
* @return Request|false The request if it is found and belongs to the current user, false if not
|
||||
* @return Option<Request> The request (if it is found and belongs to the current user)
|
||||
* @throws DocumentException If any is encountered
|
||||
*/
|
||||
public static function byId(string $id): Request|false
|
||||
public static function byId(string $id): Option
|
||||
{
|
||||
$req = Find::byId(Table::REQUEST, $id, self::class);
|
||||
return ($req && $req->userId == $_SESSION['user_id']) ? $req : false;
|
||||
return ($req->getOrElse(new Request('x'))->userId == $_SESSION['user_id']) ? $req : None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,7 +87,7 @@ Layout::pageHead('Documentation'); ?>
|
||||
Now”). The “Answered” link shows all requests that have been marked answered. The
|
||||
“Snoozed” link only shows snoozed requests.
|
||||
|
||||
<h3 class="mb-3 mt-4">Final Notes</h3>
|
||||
<h3 id=notes class="mb-3 mt-4">Final Notes</h3>
|
||||
<ul>
|
||||
<li>If you encounter errors, please
|
||||
<a href=https://git.bitbadger.solutions/bit-badger/myPrayerJournal/issues target=_blank rel=noopener>file an
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use MyPrayerJournal\UI\Layout;
|
||||
use MyPrayerJournal\UI\Component;use MyPrayerJournal\UI\Layout;
|
||||
|
||||
require '../start.php';
|
||||
if ($_SERVER['REQUEST_METHOD'] <> 'GET') not_found();
|
||||
@@ -14,5 +14,8 @@ Layout::pageHead('Welcome'); ?>
|
||||
<p>This site is open and available for anyone who wants to use it. To get started, simply click the “Log
|
||||
On” link above, and log on with either a Microsoft or Google account. You can also learn more about the
|
||||
site at the “Docs” link, also above.
|
||||
<hr>
|
||||
<p><em>This is an in-progress upgrade from v3 to v4; if you encounter errors, see
|
||||
<?=Component::pageLink('/docs#notes', 'the documentation')?> on reporting them.</em>
|
||||
</article><?php
|
||||
Layout::pageFoot();
|
||||
|
||||
@@ -13,14 +13,13 @@ $isNew = $_GET['id'] == 'new';
|
||||
|
||||
$req = match ($isNew) {
|
||||
true => new Request('new'),
|
||||
false => Request::byId($_GET['id'])
|
||||
false => Request::byId($_GET['id'])->getOrCall(not_found(...))
|
||||
};
|
||||
if (!$req) not_found();
|
||||
|
||||
$cancelLink = match (true) {
|
||||
str_ends_with($_SERVER['HTTP_REFERER'] ?? '', 'active.php') => '/requests/active',
|
||||
str_ends_with($_SERVER['HTTP_REFERER'] ?? '', 'snoozed.php') => '/requests/snoozed',
|
||||
default => '/journal'
|
||||
str_ends_with($_SERVER['HTTP_REFERER'] ?? '', 'active') => '/requests/active',
|
||||
str_ends_with($_SERVER['HTTP_REFERER'] ?? '', 'snoozed') => '/requests/snoozed',
|
||||
default => '/journal'
|
||||
};
|
||||
$action = $_GET['id'] == 'new' ? 'Add' : 'Edit';
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
||||
see_other('/journal');
|
||||
|
||||
case 'PATCH':
|
||||
$req = Request::byId($_PATCH['requestId']);
|
||||
if (!$req) not_found();
|
||||
$req = Request::byId($_PATCH['requestId'])->getOrCall(not_found(...));
|
||||
$patch = [];
|
||||
// update recurrence if changed
|
||||
if ($recurrence != $req->recurrence) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Auth0\SDK\Exception\ConfigurationException;
|
||||
use BitBadger\PDODocument\{Configuration, Definition, DocumentException, Mode};
|
||||
use BitBadger\PDODocument\{AutoId, Configuration, Definition, DocumentException, Mode};
|
||||
use Dotenv\Dotenv;
|
||||
use MyPrayerJournal\{Auth, Table};
|
||||
use MyPrayerJournal\Domain\Request;
|
||||
@@ -24,8 +24,11 @@ if (php_sapi_name() != 'cli') {
|
||||
$_REQUEST['time_zone'] = $_SERVER['HTTP_X_TIME_ZONE'] ?? 'Etc/UTC';
|
||||
}
|
||||
|
||||
Configuration::$pdoDSN = 'sqlite:' . implode(DIRECTORY_SEPARATOR, [__DIR__, 'data', 'mpj.db']);
|
||||
Configuration::$mode = Mode::SQLite;
|
||||
Configuration::$pdoDSN = 'sqlite:' . implode(DIRECTORY_SEPARATOR, [__DIR__, 'data', 'mpj.db']);
|
||||
Configuration::$mode = Mode::SQLite;
|
||||
Configuration::$autoId = AutoId::RandomString;
|
||||
Configuration::$idStringLength = 12;
|
||||
|
||||
Definition::ensureTable(Table::REQUEST);
|
||||
Definition::ensureFieldIndex(Table::REQUEST, 'user', ['userId']);
|
||||
|
||||
@@ -79,8 +82,5 @@ function validate_request(string $id, array $methods, bool $redirect = true): Re
|
||||
|
||||
Auth::requireUser($redirect);
|
||||
|
||||
$req = Request::byId($id);
|
||||
if (!$req) not_found();
|
||||
|
||||
return $req;
|
||||
return Request::byId($id)->getOrCall(not_found(...));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user