1
0
Fork 0
mirror of synced 2024-09-30 17:26:48 +13:00

Create Appwrite Query Validator

The Appwrite Query Validator checks if the cursor value is a valid UID.
This is different than the cursor value in utopia-php/database because
the value in the database layer is expected to be a document.
This commit is contained in:
Steven 2022-08-15 19:31:14 +00:00
parent bc9e928187
commit 753aebccab

View file

@ -0,0 +1,21 @@
<?php
namespace Appwrite\Utopia\Database\Validator;
use Utopia\Database\Validator\UID;
use Utopia\Database\Validator\Query as QueryValidator;
class Query extends QueryValidator
{
protected function isValidCursor($cursor): bool
{
$validator = new UID();
if ($validator->isValid($cursor)) {
return true;
}
$this->message = 'Invalid cursor: ' . $validator->getDescription();
return false;
}
}