mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Simplify validator override
This commit is contained in:
parent
4cf3d0b87b
commit
c894b0ab6a
1 changed files with 7 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ use Utopia\Database\Query;
|
|||
use Utopia\Database\Validator\Query\Cursor;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\Validator;
|
||||
use Utopia\Validator\Text;
|
||||
|
||||
class XList extends Action
|
||||
|
|
@ -26,9 +27,14 @@ class XList extends Action
|
|||
{
|
||||
return 'listProjects';
|
||||
}
|
||||
|
||||
// Stored as property intentionally for extensibility
|
||||
protected Validator $queriesValidator;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->queriesValidator = new Projects();
|
||||
|
||||
$this
|
||||
->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET)
|
||||
->setHttpPath('/v1/projects')
|
||||
|
|
@ -51,7 +57,7 @@ class XList extends Action
|
|||
],
|
||||
contentType: ContentType::JSON
|
||||
))
|
||||
->param('queries', [], new Projects(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Projects::ALLOWED_ATTRIBUTES), true)
|
||||
->param('queries', [], $this->queriesValidator, 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Projects::ALLOWED_ATTRIBUTES), true)
|
||||
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
|
||||
->inject('response')
|
||||
->inject('dbForPlatform')
|
||||
|
|
|
|||
Loading…
Reference in a new issue