fix collections.php

This commit is contained in:
fogelito
2023-08-15 00:41:34 +03:00
parent ab9ee84ed0
commit 0522affba0
3 changed files with 94 additions and 92 deletions
+91 -90
View File
@@ -1228,6 +1228,96 @@ $commonCollections = [
],
],
],
'slowQueries' => [
'$collection' => Database::METADATA,
'$id' => 'slowQueries',
'name' => 'slowQueries',
'attributes' => [
[
'$id' => ID::custom('blocked'),
'type' => Database::VAR_BOOLEAN,
'format' => '',
'size' => 0,
'signed' => true,
'required' => true,
'default' => false,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('count'),
'type' => Database::VAR_INTEGER,
'format' => '',
'size' => 0,
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('queries'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 410002,
'signed' => false,
'required' => true,
'default' => [],
'array' => false,
'filters' => ['json'],
],
[
'$id' => ID::custom('path'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 2500,
'signed' => false,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('databaseId'),
'type' => Database::VAR_STRING,
'signed' => true,
'size' => Database::LENGTH_KEY,
'format' => '',
'filters' => [],
'required' => true,
'default' => null,
'array' => false,
],
[
'$id' => ID::custom('collectionId'),
'type' => Database::VAR_STRING,
'signed' => true,
'size' => Database::LENGTH_KEY,
'format' => '',
'filters' => [],
'required' => true,
'default' => null,
'array' => false,
],
],
'indexes' => [
[
'$id' => '_key_database_id',
'type' => Database::INDEX_KEY,
'attributes' => ['databaseId', 'collectionId'],
'lengths' => [],
'orders' => []
],
[
'$id' => '_key_blocked',
'type' => Database::INDEX_KEY,
'attributes' => ['blocked', 'databaseId', 'collectionId'],
'lengths' => [],
'orders' => []
]
],
],
];
$projectCollections = array_merge([
@@ -3877,96 +3967,7 @@ $dbCollections = [
'orders' => [Database::ORDER_ASC],
],
],
],
'slowQueries' => [
'$collection' => Database::METADATA,
'$id' => 'slowQueries',
'name' => 'slowQueries',
'attributes' => [
[
'$id' => ID::custom('blocked'),
'type' => Database::VAR_BOOLEAN,
'format' => '',
'size' => 0,
'signed' => true,
'required' => true,
'default' => false,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('count'),
'type' => Database::VAR_INTEGER,
'format' => '',
'size' => 0,
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('queries'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 410002,
'signed' => false,
'required' => true,
'default' => [],
'array' => false,
'filters' => ['json'],
],
[
'$id' => ID::custom('path'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 2500,
'signed' => false,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('databaseId'),
'type' => Database::VAR_STRING,
'signed' => true,
'size' => Database::LENGTH_KEY,
'format' => '',
'filters' => [],
'required' => true,
'default' => null,
'array' => false,
],
[
'$id' => ID::custom('collectionId'),
'type' => Database::VAR_STRING,
'signed' => true,
'size' => Database::LENGTH_KEY,
'format' => '',
'filters' => [],
'required' => true,
'default' => null,
'array' => false,
],
],
'indexes' => [
[
'$id' => '_key_database_id',
'type' => Database::INDEX_KEY,
'attributes' => ['databaseId', 'collectionId'],
'lengths' => [],
'orders' => []
],
[
'$id' => '_key_blocked',
'type' => Database::INDEX_KEY,
'attributes' => ['blocked', 'databaseId', 'collectionId'],
'lengths' => [],
'orders' => []
]
],
],
]
];
+2 -2
View File
@@ -2908,7 +2908,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents')
App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
->alias('/v1/database/collections/:collectionId/documents', ['databaseId' => 'default'])
->desc('List Documents')
->groups(['api', 'database','timeout'])
->groups(['api', 'database', 'timeout'])
->label('scope', 'documents.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'databases')
@@ -2921,12 +2921,12 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
->param('databaseId', '', new UID(), 'Database ID.')
->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).')
->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), '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.', true)
->inject('request')
->inject('response')
->inject('dbForProject')
->inject('mode')
->action(function (string $databaseId, string $collectionId, array $queries, Request $request, Response $response, Database $dbForProject, string $mode) {
var_dump("inininininininni");
$database = Authorization::skip(fn() => $dbForProject->getDocument('databases', $databaseId));
if ($database->isEmpty() || (!$database->getAttribute('enabled') && $mode !== APP_MODE_ADMIN)) {
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Databases;
use Appwrite\Extend\Exception;
use Tests\E2E\Client;
use Utopia\Database\Database;
use Utopia\Database\DateTime;