From 3ad1bcbb25aad97276f7d729a7a928a520e1e2f0 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 12 Aug 2025 12:59:42 +0000 Subject: [PATCH] Move Select validator to Utopia namespace and remove Appwrite-specific implementation Co-authored-by: jakeb994 --- .../Database/Validator/Queries/Base.php | 2 +- .../Database/Validator/Query/Select.php | 58 ------------------- 2 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 src/Appwrite/Utopia/Database/Validator/Query/Select.php diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Base.php b/src/Appwrite/Utopia/Database/Validator/Queries/Base.php index c99a76d31e..a1aec7c1ed 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Base.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Base.php @@ -11,7 +11,7 @@ use Utopia\Database\Validator\Query\Filter; use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\Query\Order; -use Appwrite\Utopia\Database\Validator\Query\Select; +use Utopia\Database\Validator\Query\Select; class Base extends Queries { diff --git a/src/Appwrite/Utopia/Database/Validator/Query/Select.php b/src/Appwrite/Utopia/Database/Validator/Query/Select.php deleted file mode 100644 index 2afe7cc5d6..0000000000 --- a/src/Appwrite/Utopia/Database/Validator/Query/Select.php +++ /dev/null @@ -1,58 +0,0 @@ -schema[$attribute->getAttribute('key')] = $attribute->getAttribute('type'); - } - } - - protected function isValidAttribute(string $attribute): bool - { - if (str_starts_with($attribute, '$')) { - return true; // Allow system attributes - } - - return array_key_exists($attribute, $this->schema); - } - - public function isValid(mixed $query): bool - { - if (!$query instanceof \Utopia\Database\Query) { - return false; - } - - if ($query->getMethod() !== Query::TYPE_SELECT) { - return false; - } - - $values = $query->getValues(); - - foreach ($values as $attribute) { - if (!$this->isValidAttribute($attribute)) { - $this->message = 'Query select is not valid: Attribute "' . $attribute . '" not found.'; - return false; - } - } - - return true; - } - - public function getType(): string - { - return Query::TYPE_SELECT; - } -} \ No newline at end of file