1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

feat: remove redundant order attributes validation

This commit is contained in:
Christy Jacob 2022-05-18 04:36:24 +04:00
parent 390631c06c
commit 5463e62a6e
4 changed files with 15 additions and 23 deletions

View file

@ -116,7 +116,7 @@ return [
[
'key' => 'android',
'name' => 'Android',
'version' => '0.6.0',
'version' => '0.6.1',
'url' => 'https://github.com/appwrite/sdk-for-android',
'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-android',
'enabled' => true,

View file

@ -19,7 +19,6 @@ use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Key;
use Utopia\Database\Validator\Permissions;
use Utopia\Database\Validator\QueryValidator;
use Utopia\Database\Validator\OrderAttributes;
use Utopia\Database\Validator\Structure;
use Utopia\Database\Validator\UID;
use Utopia\Database\Exception\Authorization as AuthorizationException;
@ -32,7 +31,7 @@ use Appwrite\Network\Validator\IP;
use Appwrite\Network\Validator\URL;
use Appwrite\Utopia\Database\Validator\CustomId;
use Appwrite\Utopia\Database\Validator\Queries as QueriesValidator;
use Appwrite\Utopia\Database\Validator\OrderAttributes as OrderAttributesValidator;
use Appwrite\Utopia\Database\Validator\OrderAttributes;
use Appwrite\Utopia\Response;
use Appwrite\Detector\Detector;
use Appwrite\Event\Audit as EventAudit;
@ -1776,20 +1775,13 @@ App::get('/v1/database/collections/:collectionId/documents')
if(!empty($orderAttributes)) {
$validator = new OrderAttributes($collection->getAttribute('attributes', []), $collection->getAttribute('indexes', []), true);
if (!$validator->isValid($orderAttributes)) {
throw new Exception($validator->getDescription(), 400);
}
}
if (!empty($queries)) {
$validator = new QueriesValidator(new QueryValidator($collection->getAttribute('attributes', [])), $collection->getAttribute('indexes', []), true);
if (!$validator->isValid($queries)) {
throw new Exception($validator->getDescription(), 400, Exception::GENERAL_QUERY_INVALID);
}
}
if(!empty($orderAttributes)) {
$validator = new OrderAttributesValidator($collection->getAttribute('attributes', []), $collection->getAttribute('indexes', []), true);
if (!$validator->isValid($orderAttributes)) {
if (!empty($queries)) {
$validator = new QueriesValidator(new QueryValidator($collection->getAttribute('attributes', [])), $collection->getAttribute('indexes', []), true);
if (!$validator->isValid($queries)) {
throw new Exception($validator->getDescription(), 400, Exception::GENERAL_QUERY_INVALID);
}
}

View file

@ -71,7 +71,7 @@
}
],
"require-dev": {
"appwrite/sdk-generator": "0.18.4",
"appwrite/sdk-generator": "0.18.6",
"phpunit/phpunit": "9.5.20",
"swoole/ide-helper": "4.8.9",
"textalk/websocket": "1.5.7",

16
composer.lock generated
View file

@ -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": "ae4e8cc9efbd28d8c2536e378c9e7ead",
"content-hash": "69e0c12a4c4b22cf17727f5b8833b1ac",
"packages": [
{
"name": "adhocore/jwt",
@ -3075,16 +3075,16 @@
},
{
"name": "appwrite/sdk-generator",
"version": "0.18.4",
"version": "0.18.6",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "841281fab95c774d5aa96f5bf9bd0dabf9f96e8d"
"reference": "c0914d9f4047fd7b86112c289d98e9161cf9d0b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/841281fab95c774d5aa96f5bf9bd0dabf9f96e8d",
"reference": "841281fab95c774d5aa96f5bf9bd0dabf9f96e8d",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/c0914d9f4047fd7b86112c289d98e9161cf9d0b0",
"reference": "c0914d9f4047fd7b86112c289d98e9161cf9d0b0",
"shasum": ""
},
"require": {
@ -3119,9 +3119,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.18.4"
"source": "https://github.com/appwrite/sdk-generator/tree/0.18.6"
},
"time": "2022-05-17T12:16:09+00:00"
"time": "2022-05-17T15:09:23+00:00"
},
{
"name": "composer/pcre",
@ -6576,5 +6576,5 @@
"platform-overrides": {
"php": "8.0"
},
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.3.0"
}