mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00: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:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user