From e4392bdbfb72618f9b19fc74570bd9c62cd7de95 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 19 Aug 2022 17:05:39 +1200 Subject: [PATCH 1/7] Merge fixes (cherry picked from commit 24875e352d8f09c71897d9cc2f14bfc7ad0af46e) --- app/controllers/api/account.php | 5 ----- app/controllers/api/databases.php | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 6c63bc6316..f87e4f2b19 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1478,11 +1478,6 @@ App::patch('/v1/account/password') ->setAttribute('hashOptions', Auth::DEFAULT_ALGO_OPTIONS) ->setAttribute('passwordUpdate', DateTime::now())); - $audits - ->setResource('user/' . $user->getId()) - ->setUser($user) - ; - $usage->setParam('users.update', 1); $events->setParam('userId', $user->getId()); diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 4f3ddcc196..b82ba8119d 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -1267,6 +1267,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/dateti ->groups(['api', 'database']) ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('scope', 'collections.write') + ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk.namespace', 'databases') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.method', 'createDatetimeAttribute') @@ -1283,10 +1284,9 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/dateti ->inject('response') ->inject('dbForProject') ->inject('database') - ->inject('audits') ->inject('usage') ->inject('events') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?bool $default, bool $array, Response $response, Database $dbForProject, EventDatabase $database, EventAudit $audits, Stats $usage, Event $events) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?bool $default, bool $array, Response $response, Database $dbForProject, EventDatabase $database, Stats $usage, Event $events) { $attribute = createAttribute($databaseId, $collectionId, new Document([ 'key' => $key, @@ -1296,7 +1296,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/dateti 'default' => $default, 'array' => $array, 'filters' => ['datetime'] - ]), $response, $dbForProject, $database, $audits, $events, $usage); + ]), $response, $dbForProject, $database, $events, $usage); $response->setStatusCode(Response::STATUS_CODE_ACCEPTED); $response->dynamic($attribute, Response::MODEL_ATTRIBUTE_DATETIME); From 292037f90bb91cd521842f1aa2ea983acba1e06a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 25 Aug 2022 18:47:19 +1200 Subject: [PATCH 2/7] Fix datetime calculation --- src/Appwrite/Usage/Calculators/Database.php | 57 ++++++++++++++------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/src/Appwrite/Usage/Calculators/Database.php b/src/Appwrite/Usage/Calculators/Database.php index f5f3282497..99e7fc40ef 100644 --- a/src/Appwrite/Usage/Calculators/Database.php +++ b/src/Appwrite/Usage/Calculators/Database.php @@ -6,6 +6,8 @@ use Exception; use Appwrite\Usage\Calculator; use Utopia\Database\Database as UtopiaDatabase; use Utopia\Database\Document; +use Utopia\Database\Exception\Authorization; +use Utopia\Database\Exception\Structure; use Utopia\Database\Query; class Database extends Calculator @@ -34,14 +36,24 @@ class Database extends Calculator * @param string $projectId * @param string $metric * @param int $value - * + * @param bool $monthly * @return void + * @throws Authorization + * @throws Structure */ protected function createPerPeriodMetric(string $projectId, string $metric, int $value, bool $monthly = false): void { foreach ($this->periods as $options) { $period = $options['key']; - $time = (int) (floor(time() / $options['multiplier']) * $options['multiplier']); + $date = new \DateTime(); + if ($period === '30m') { + $minutes = $date->format('i') >= '30' ? "30" : "00"; + $time = $date->format('Y-m-d H:' . $minutes . ':00'); + } elseif ($period === '1d') { + $time = $date->format('Y-m-d 00:00:00'); + } else { + throw new Exception("Period type not found", 500); + } $this->createOrUpdateMetric($projectId, $metric, $period, $time, $value); } @@ -58,23 +70,16 @@ class Database extends Calculator * * @param string $projectId * @param string $metric + * @param string $period + * @param string $time * @param int $value * * @return void - * @throws Exception + * @throws Authorization + * @throws Structure */ - protected function createOrUpdateMetric(string $projectId, string $metric, string $period, int $time, int $value): void + protected function createOrUpdateMetric(string $projectId, string $metric, string $period, string $time, int $value): void { - $date = new \DateTime(); - if ($period === '30m') { - $minutes = $date->format('i') >= '30' ? "30" : "00"; - $time = $date->format('Y-m-d H:' . $minutes . ':00'); - } elseif ($period === '1d') { - $time = $date->format('Y-m-d 00:00:00'); - } else { - throw new Exception("Period type not found", 500); - } - $id = \md5("{$time}_{$period}_{$metric}"); $this->database->setNamespace('_' . $projectId); @@ -107,6 +112,7 @@ class Database extends Calculator /** * Foreach Document + * * Call provided callback for each document in the collection * * @param string $projectId @@ -115,6 +121,7 @@ class Database extends Calculator * @param callable $callback * * @return void + * @throws Exception */ protected function foreachDocument(string $projectId, string $collection, array $queries, callable $callback): void { @@ -156,13 +163,14 @@ class Database extends Calculator /** * Sum + * * Calculate sum of a attribute of documents in collection * * @param string $projectId * @param string $collection * @param string $attribute - * @param string $metric - * + * @param string|null $metric + * @param int $multiplier * @return int * @throws Exception */ @@ -190,16 +198,17 @@ class Database extends Calculator /** * Count + * * Count number of documents in collection * * @param string $projectId * @param string $collection - * @param string? $metric + * @param ?string $metric * * @return int * @throws Exception */ - private function count(string $projectId, string $collection, string $metric = null): int + private function count(string $projectId, string $collection, ?string $metric = null): int { $this->database->setNamespace('_' . $projectId); @@ -221,11 +230,13 @@ class Database extends Calculator /** * Deployments Total + * * Total sum of storage used by deployments * * @param string $projectId * * @return int + * @throws Exception */ private function deploymentsTotal(string $projectId): int { @@ -234,11 +245,13 @@ class Database extends Calculator /** * Users Stats + * * Metric: users.count * * @param string $projectId * * @return void + * @throws Exception */ private function usersStats(string $projectId): void { @@ -247,12 +260,15 @@ class Database extends Calculator /** * Storage Stats + * * Metrics: buckets.$all.count.total, files.$all.count.total, files.bucketId,count.total, * files.$all.storage.size, files.bucketId.storage.size, project.$all.storage.size * * @param string $projectId * * @return void + * @throws Authorization + * @throws Structure */ private function storageStats(string $projectId): void { @@ -281,6 +297,7 @@ class Database extends Calculator /** * Database Stats + * * Collect all database stats * Metrics: databases.$all.count.total, collections.$all.count.total, collections.databaseId.count.total, * documents.$all.count.all, documents.databaseId.count.total, documents.databaseId/collectionId.count.total @@ -288,6 +305,8 @@ class Database extends Calculator * @param string $projectId * * @return void + * @throws Authorization + * @throws Structure */ private function databaseStats(string $projectId): void { @@ -319,9 +338,11 @@ class Database extends Calculator /** * Collect Stats + * * Collect all database related stats * * @return void + * @throws Exception */ public function collect(): void { From 10b8b4b4f6fefd50af266fa35311c38784568b44 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 25 Aug 2022 18:48:05 +1200 Subject: [PATCH 3/7] Format --- src/Appwrite/Usage/Calculators/Database.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Usage/Calculators/Database.php b/src/Appwrite/Usage/Calculators/Database.php index 99e7fc40ef..50887ef1cc 100644 --- a/src/Appwrite/Usage/Calculators/Database.php +++ b/src/Appwrite/Usage/Calculators/Database.php @@ -112,7 +112,7 @@ class Database extends Calculator /** * Foreach Document - * + * * Call provided callback for each document in the collection * * @param string $projectId @@ -163,7 +163,7 @@ class Database extends Calculator /** * Sum - * + * * Calculate sum of a attribute of documents in collection * * @param string $projectId @@ -198,7 +198,7 @@ class Database extends Calculator /** * Count - * + * * Count number of documents in collection * * @param string $projectId @@ -230,7 +230,7 @@ class Database extends Calculator /** * Deployments Total - * + * * Total sum of storage used by deployments * * @param string $projectId @@ -245,7 +245,7 @@ class Database extends Calculator /** * Users Stats - * + * * Metric: users.count * * @param string $projectId @@ -260,7 +260,7 @@ class Database extends Calculator /** * Storage Stats - * + * * Metrics: buckets.$all.count.total, files.$all.count.total, files.bucketId,count.total, * files.$all.storage.size, files.bucketId.storage.size, project.$all.storage.size * @@ -297,7 +297,7 @@ class Database extends Calculator /** * Database Stats - * + * * Collect all database stats * Metrics: databases.$all.count.total, collections.$all.count.total, collections.databaseId.count.total, * documents.$all.count.all, documents.databaseId.count.total, documents.databaseId/collectionId.count.total @@ -338,7 +338,7 @@ class Database extends Calculator /** * Collect Stats - * + * * Collect all database related stats * * @return void From c04734048f0764617d6405a3f2bdb9eb2b1a1194 Mon Sep 17 00:00:00 2001 From: Shmuel Fogel Date: Thu, 25 Aug 2022 11:05:01 +0300 Subject: [PATCH 4/7] Update app/controllers/api/databases.php Co-authored-by: Vincent (Wen Yu) Ge --- app/controllers/api/databases.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 142d5a599f..eba69e69a5 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -1918,7 +1918,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents') ->param('cursor', '', new UID(), 'ID of the document used as the starting point for the query, excluding the document itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)', true) ->param('cursorDirection', Database::CURSOR_AFTER, new WhiteList([Database::CURSOR_AFTER, Database::CURSOR_BEFORE]), 'Direction of the cursor, can be either \'before\' or \'after\'.', true) ->param('orderAttributes', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of attributes used to sort results. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' order attributes are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) - ->param('orderTypes', [], new ArrayList(new WhiteList([Database::ORDER_DESC, Database::ORDER_ASC], true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' order types are allowed.', true) + ->param('orderTypes', [], new ArrayList(new WhiteList([Database::ORDER_DESC, Database::ORDER_ASC], true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of order directions for sorting attributes. Possible values are DESC for descending order or ASC for ascending order. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' order types are allowed.', true) ->inject('response') ->inject('dbForProject') ->inject('mode') From 26a2569b8e531e3dc50dfef6c9c6a6d5c9d477ac Mon Sep 17 00:00:00 2001 From: Shmuel Fogel Date: Thu, 25 Aug 2022 11:11:08 +0300 Subject: [PATCH 5/7] Update src/Appwrite/Utopia/Response/Model/Func.php Co-authored-by: Vincent (Wen Yu) Ge --- src/Appwrite/Utopia/Response/Model/Func.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Model/Func.php b/src/Appwrite/Utopia/Response/Model/Func.php index 05384782e4..89f739cf58 100644 --- a/src/Appwrite/Utopia/Response/Model/Func.php +++ b/src/Appwrite/Utopia/Response/Model/Func.php @@ -82,7 +82,7 @@ class Func extends Model ]) ->addRule('scheduleNext', [ 'type' => self::TYPE_DATETIME, - 'description' => 'Function next scheduled execution date in Datetime.', + 'description' => 'Function's next scheduled execution time in Datetime.', 'default' => '', 'example' => self::TYPE_DATETIME_EXAMPLE, ]) From deb5164eb3d56406f0164553942a4d7e8a559949 Mon Sep 17 00:00:00 2001 From: Shmuel Fogel Date: Thu, 25 Aug 2022 11:11:17 +0300 Subject: [PATCH 6/7] Update src/Appwrite/Utopia/Response/Model/Func.php Co-authored-by: Vincent (Wen Yu) Ge --- src/Appwrite/Utopia/Response/Model/Func.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Model/Func.php b/src/Appwrite/Utopia/Response/Model/Func.php index 89f739cf58..6ef09a9c9d 100644 --- a/src/Appwrite/Utopia/Response/Model/Func.php +++ b/src/Appwrite/Utopia/Response/Model/Func.php @@ -88,7 +88,7 @@ class Func extends Model ]) ->addRule('schedulePrevious', [ 'type' => self::TYPE_DATETIME, - 'description' => 'Function Previous scheduled execution date in Datetime.', + 'description' => 'Function's previous scheduled execution time in Datetime.', 'default' => '', 'example' => self::TYPE_DATETIME_EXAMPLE, ]) From c30189f90391c0d1379325792587a663e561067c Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 25 Aug 2022 11:14:27 +0300 Subject: [PATCH 7/7] Vincent Changes Apply --- app/controllers/api/databases.php | 40 +++++++++---------- src/Appwrite/Utopia/Response/Model/Bucket.php | 2 +- .../Utopia/Response/Model/Session.php | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 142d5a599f..39b2900d21 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -841,7 +841,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/string ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_STRING) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('size', null, new Range(1, APP_DATABASE_ATTRIBUTE_STRING_MAX_LENGTH, Range::TYPE_INTEGER), 'Attribute size for text attributes, in number of characters.') ->param('required', null, new Boolean(), 'Is attribute required?') @@ -889,7 +889,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/email' ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_EMAIL) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Email(), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true) @@ -931,7 +931,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/enum') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_ENUM) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('elements', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' elements are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.') ->param('required', null, new Boolean(), 'Is attribute required?') @@ -989,7 +989,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/ip') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_IP) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new IP(), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true) @@ -1031,7 +1031,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/url') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_URL) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new URL(), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true) @@ -1073,7 +1073,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/intege ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_INTEGER) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('min', null, new Integer(), 'Minimum value to enforce on new documents', true) @@ -1144,7 +1144,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/float' ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_FLOAT) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('min', null, new FloatValidator(), 'Minimum value to enforce on new documents', true) @@ -1218,7 +1218,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/boolea ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_BOOLEAN) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Boolean(), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true) @@ -1258,7 +1258,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/dateti ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_DATETIME) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new DatetimeValidator(), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true) @@ -1300,7 +1300,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/attributes') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_LIST) ->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/database#createCollection).') + ->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).') ->inject('response') ->inject('dbForProject') ->action(function (string $databaseId, string $collectionId, Response $response, Database $dbForProject) { @@ -1349,7 +1349,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/attributes/:key') Response::MODEL_ATTRIBUTE_DATETIME, Response::MODEL_ATTRIBUTE_STRING])// needs to be last, since its condition would dominate any other string attribute ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->inject('response') ->inject('dbForProject') @@ -1411,7 +1411,7 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/attributes/:key ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.model', Response::MODEL_NONE) ->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/database#createCollection).') + ->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('key', '', new Key(), 'Attribute Key.') ->inject('response') ->inject('dbForProject') @@ -1499,7 +1499,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_INDEX) ->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/database#createCollection).') + ->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('key', null, new Key(), 'Index Key.') ->param('type', null, new WhiteList([Database::INDEX_KEY, Database::INDEX_FULLTEXT, Database::INDEX_UNIQUE, Database::INDEX_SPATIAL, Database::INDEX_ARRAY]), 'Index type.') ->param('attributes', null, new ArrayList(new Key(true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of attributes to index. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' attributes are allowed, each 32 characters long.') @@ -1645,7 +1645,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/indexes') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_INDEX_LIST) ->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/database#createCollection).') + ->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).') ->inject('response') ->inject('dbForProject') ->action(function (string $databaseId, string $collectionId, Response $response, Database $dbForProject) { @@ -1684,7 +1684,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/indexes/:key') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_INDEX) ->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/database#createCollection).') + ->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('key', null, new Key(), 'Index Key.') ->inject('response') ->inject('dbForProject') @@ -1733,7 +1733,7 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/indexes/:key') ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.model', Response::MODEL_NONE) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('collectionId', null, new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).') + ->param('collectionId', null, new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') ->param('key', '', new Key(), 'Index Key.') ->inject('response') ->inject('dbForProject') @@ -1802,7 +1802,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents') ->label('sdk.response.model', Response::MODEL_DOCUMENT) ->param('databaseId', '', new UID(), 'Database ID.') ->param('documentId', '', new CustomId(), 'Document ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') - ->param('collectionId', null, new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection). Make sure to define attributes before creating documents.') + ->param('collectionId', null, new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.') ->param('data', [], new JSON(), 'Document data as JSON object.') ->param('read', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.', true) ->param('write', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.', true) @@ -1911,7 +1911,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_DOCUMENT_LIST) ->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/database#createCollection).') + ->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/database#querying-documents). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->param('limit', 25, new Range(0, 100), 'Maximum number of documents to return in response. By default will return maximum 25 results. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' results allowed per request.', true) ->param('offset', 0, new Range(0, APP_LIMIT_COUNT), 'Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)', true) @@ -2024,7 +2024,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents/:documen ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_DOCUMENT) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('collectionId', null, new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).') + ->param('collectionId', null, new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') ->param('documentId', null, new UID(), 'Document ID.') ->inject('response') ->inject('dbForProject') @@ -2315,7 +2315,7 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/documents/:docu ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.model', Response::MODEL_NONE) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('collectionId', null, new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).') + ->param('collectionId', null, new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') ->param('documentId', null, new UID(), 'Document ID.') ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Utopia/Response/Model/Bucket.php b/src/Appwrite/Utopia/Response/Model/Bucket.php index ec2a86b30d..f5d9a5bb76 100644 --- a/src/Appwrite/Utopia/Response/Model/Bucket.php +++ b/src/Appwrite/Utopia/Response/Model/Bucket.php @@ -18,7 +18,7 @@ class Bucket extends Model ]) ->addRule('$createdAt', [ 'type' => self::TYPE_DATETIME, - 'description' => 'Bucket creation date in Datetime', + 'description' => 'Bucket creation time in Datetime', 'default' => '', 'example' => self::TYPE_DATETIME_EXAMPLE, ]) diff --git a/src/Appwrite/Utopia/Response/Model/Session.php b/src/Appwrite/Utopia/Response/Model/Session.php index 73c78b3c1b..799cb6e763 100644 --- a/src/Appwrite/Utopia/Response/Model/Session.php +++ b/src/Appwrite/Utopia/Response/Model/Session.php @@ -54,7 +54,7 @@ class Session extends Model ]) ->addRule('providerAccessTokenExpiry', [ 'type' => self::TYPE_DATETIME, - 'description' => 'The date of when the access token expires in datetime format.', + 'description' => 'The date of when the access token expires in Datetime format.', 'default' => '', 'example' => self::TYPE_DATETIME_EXAMPLE, ])