From 00e64e35180225c8988990044e1da01df450940a Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 14 Aug 2022 13:10:32 +0300 Subject: [PATCH 1/3] datetime tests fixes --- app/controllers/api/databases.php | 1 + composer.json | 4 +- composer.lock | 40 +++++++++---------- .../e2e/Services/Databases/DatabasesBase.php | 6 +-- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 7b8dbf4037..84f3079e12 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -1322,6 +1322,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/dateti 'filters' => ['datetime'] ]), $response, $dbForProject, $database, $audits, $events, $usage); + $response->setStatusCode(Response::STATUS_CODE_ACCEPTED); $response->dynamic($attribute, Response::MODEL_ATTRIBUTE_DATETIME); }); diff --git a/composer.json b/composer.json index 5fa507dcca..63f49ab2fe 100644 --- a/composer.json +++ b/composer.json @@ -44,9 +44,9 @@ "appwrite/php-runtimes": "0.10.*", "utopia-php/framework": "0.20.*", "utopia-php/logger": "0.3.*", - "utopia-php/abuse": "dev-origin/timestamp-to-datetime as 0.7.2", + "utopia-php/abuse": "0.8.*", "utopia-php/analytics": "0.2.*", - "utopia-php/audit": "dev-origin/unix-to-datetime as 0.8.2", + "utopia-php/audit": "0.9.*", "utopia-php/cache": "0.6.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", diff --git a/composer.lock b/composer.lock index 903b7476a4..43ee07c535 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "993486075710ab0cdbba6c33f0b09218", + "content-hash": "55e1dfca29bbf789b3d748f5ca995495", "packages": [ { "name": "adhocore/jwt", @@ -1733,16 +1733,16 @@ }, { "name": "utopia-php/abuse", - "version": "0.7.0", + "version": "0.8.0", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "52fb20e39e2e9619948bc0a73b52e10caa71350d" + "reference": "8350d498c95bdcc803b7e39575ea04fd5c7561b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/52fb20e39e2e9619948bc0a73b52e10caa71350d", - "reference": "52fb20e39e2e9619948bc0a73b52e10caa71350d", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/8350d498c95bdcc803b7e39575ea04fd5c7561b9", + "reference": "8350d498c95bdcc803b7e39575ea04fd5c7561b9", "shasum": "" }, "require": { @@ -1780,9 +1780,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.7.0" + "source": "https://github.com/utopia-php/abuse/tree/0.8.0" }, - "time": "2021-12-27T13:06:45+00:00" + "time": "2022-08-08T12:48:24+00:00" }, { "name": "utopia-php/analytics", @@ -1841,16 +1841,16 @@ }, { "name": "utopia-php/audit", - "version": "0.8.0", + "version": "0.9.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "b46dc42614a69437c45eb229249b6a6d000122c1" + "reference": "2c52de04e7ffeb2256a09d9213e87b001b7e66d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/b46dc42614a69437c45eb229249b6a6d000122c1", - "reference": "b46dc42614a69437c45eb229249b6a6d000122c1", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/2c52de04e7ffeb2256a09d9213e87b001b7e66d2", + "reference": "2c52de04e7ffeb2256a09d9213e87b001b7e66d2", "shasum": "" }, "require": { @@ -1888,9 +1888,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.8.0" + "source": "https://github.com/utopia-php/audit/tree/0.9.0" }, - "time": "2021-12-27T13:05:56+00:00" + "time": "2022-08-08T12:46:24+00:00" }, { "name": "utopia-php/cache", @@ -2051,16 +2051,16 @@ }, { "name": "utopia-php/database", - "version": "0.18.9", + "version": "0.19.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "227b3ca919149b7b0d6556c8effe9ee46ed081e6" + "reference": "207d9f2665bf2124797351dfdcc928a46a301b04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/227b3ca919149b7b0d6556c8effe9ee46ed081e6", - "reference": "227b3ca919149b7b0d6556c8effe9ee46ed081e6", + "url": "https://api.github.com/repos/utopia-php/database/zipball/207d9f2665bf2124797351dfdcc928a46a301b04", + "reference": "207d9f2665bf2124797351dfdcc928a46a301b04", "shasum": "" }, "require": { @@ -2109,9 +2109,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.18.9" + "source": "https://github.com/utopia-php/database/tree/0.19.0" }, - "time": "2022-07-19T09:42:53+00:00" + "time": "2022-08-01T11:51:01+00:00" }, { "name": "utopia-php/domains", @@ -5370,5 +5370,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 398071c22e..332079cd99 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -197,7 +197,7 @@ trait DatabasesBase $this->assertEquals($actors['body']['required'], false); $this->assertEquals($actors['body']['array'], true); - $this->assertEquals($datetime['headers']['status-code'], 201); + $this->assertEquals($datetime['headers']['status-code'], 202); $this->assertEquals($datetime['body']['key'], 'birthDay'); $this->assertEquals($datetime['body']['type'], 'datetime'); $this->assertEquals($datetime['body']['required'], false); @@ -410,7 +410,7 @@ trait DatabasesBase $this->assertEquals(false, $boolean['body']['array']); $this->assertEquals(true, $boolean['body']['default']); - $this->assertEquals(201, $datetime['headers']['status-code']); + $this->assertEquals(202, $datetime['headers']['status-code']); $this->assertEquals('datetime', $datetime['body']['key']); $this->assertEquals('datetime', $datetime['body']['type']); $this->assertEquals(false, $datetime['body']['required']); @@ -834,7 +834,7 @@ trait DatabasesBase 'attributes' => ['birthDay'], ]); - $this->assertEquals(201, $releaseWithDate['headers']['status-code']); + $this->assertEquals(202, $releaseWithDate['headers']['status-code']); $this->assertEquals('birthDay', $releaseWithDate['body']['key']); $this->assertEquals('key', $releaseWithDate['body']['type']); $this->assertCount(1, $releaseWithDate['body']['attributes']); From 9b9f2fe428382de50c7a97f0c9a8077ef995824f Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 14 Aug 2022 13:27:07 +0300 Subject: [PATCH 2/3] global const for TYPE_DATETIME_EXAMPLE --- src/Appwrite/Utopia/Response/Model.php | 1 + src/Appwrite/Utopia/Response/Model/AttributeDatetime.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Bucket.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Build.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Collection.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Deployment.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Document.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Domain.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Execution.php | 4 ++-- src/Appwrite/Utopia/Response/Model/File.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Func.php | 8 ++++---- src/Appwrite/Utopia/Response/Model/Key.php | 6 +++--- src/Appwrite/Utopia/Response/Model/Log.php | 2 +- src/Appwrite/Utopia/Response/Model/Membership.php | 8 ++++---- src/Appwrite/Utopia/Response/Model/Platform.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Project.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Session.php | 6 +++--- src/Appwrite/Utopia/Response/Model/Team.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Token.php | 4 ++-- src/Appwrite/Utopia/Response/Model/User.php | 8 ++++---- src/Appwrite/Utopia/Response/Model/Webhook.php | 4 ++-- 21 files changed, 48 insertions(+), 47 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model.php b/src/Appwrite/Utopia/Response/Model.php index 1f7e46d048..1a37bed22f 100644 --- a/src/Appwrite/Utopia/Response/Model.php +++ b/src/Appwrite/Utopia/Response/Model.php @@ -12,6 +12,7 @@ abstract class Model public const TYPE_BOOLEAN = 'boolean'; public const TYPE_JSON = 'json'; public const TYPE_DATETIME = 'datetime'; + public const TYPE_DATETIME_EXAMPLE = '2020-10-15 09:38:00+03:00'; /** * @var bool diff --git a/src/Appwrite/Utopia/Response/Model/AttributeDatetime.php b/src/Appwrite/Utopia/Response/Model/AttributeDatetime.php index b0aac3c686..6305d091fb 100644 --- a/src/Appwrite/Utopia/Response/Model/AttributeDatetime.php +++ b/src/Appwrite/Utopia/Response/Model/AttributeDatetime.php @@ -21,7 +21,7 @@ class AttributeDatetime extends Attribute 'type' => self::TYPE_DATETIME, 'description' => 'Attribute type.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('format', [ 'type' => self::TYPE_DATETIME, @@ -35,7 +35,7 @@ class AttributeDatetime extends Attribute 'type' => self::TYPE_STRING, 'description' => 'Default value for attribute when not provided. Only null is optional', 'default' => null, - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, 'array' => false, 'require' => false, ]) diff --git a/src/Appwrite/Utopia/Response/Model/Bucket.php b/src/Appwrite/Utopia/Response/Model/Bucket.php index 89f8c5778a..ec2a86b30d 100644 --- a/src/Appwrite/Utopia/Response/Model/Bucket.php +++ b/src/Appwrite/Utopia/Response/Model/Bucket.php @@ -20,13 +20,13 @@ class Bucket extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Bucket creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Bucket update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$read', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Build.php b/src/Appwrite/Utopia/Response/Model/Build.php index b95ee9dc72..84e58c70d5 100644 --- a/src/Appwrite/Utopia/Response/Model/Build.php +++ b/src/Appwrite/Utopia/Response/Model/Build.php @@ -49,13 +49,13 @@ class Build extends Model 'type' => self::TYPE_DATETIME, 'description' => 'The deployment creation date in Datetime.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('endTime', [ 'type' => self::TYPE_DATETIME, 'description' => 'The time the build was finished in Datetime.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('duration', [ 'type' => self::TYPE_INTEGER, diff --git a/src/Appwrite/Utopia/Response/Model/Collection.php b/src/Appwrite/Utopia/Response/Model/Collection.php index 3b3c734228..7010c627c4 100644 --- a/src/Appwrite/Utopia/Response/Model/Collection.php +++ b/src/Appwrite/Utopia/Response/Model/Collection.php @@ -20,13 +20,13 @@ class Collection extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Collection creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Collection update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$read', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Deployment.php b/src/Appwrite/Utopia/Response/Model/Deployment.php index 2f69d07d0c..0a26fe30ef 100644 --- a/src/Appwrite/Utopia/Response/Model/Deployment.php +++ b/src/Appwrite/Utopia/Response/Model/Deployment.php @@ -20,13 +20,13 @@ class Deployment extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Deployment creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Deployment update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('resourceId', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Document.php b/src/Appwrite/Utopia/Response/Model/Document.php index b25bfb6724..dfb56d1774 100644 --- a/src/Appwrite/Utopia/Response/Model/Document.php +++ b/src/Appwrite/Utopia/Response/Model/Document.php @@ -46,13 +46,13 @@ class Document extends Any 'type' => self::TYPE_DATETIME, 'description' => 'Document creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Document update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$read', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Domain.php b/src/Appwrite/Utopia/Response/Model/Domain.php index 2cb98c14fa..b23f612ab3 100644 --- a/src/Appwrite/Utopia/Response/Model/Domain.php +++ b/src/Appwrite/Utopia/Response/Model/Domain.php @@ -25,13 +25,13 @@ class Domain extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Domain creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Domain update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('domain', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Execution.php b/src/Appwrite/Utopia/Response/Model/Execution.php index 98c2741465..b2ae6ffe47 100644 --- a/src/Appwrite/Utopia/Response/Model/Execution.php +++ b/src/Appwrite/Utopia/Response/Model/Execution.php @@ -20,13 +20,13 @@ class Execution extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Execution creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Execution upate date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$read', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/File.php b/src/Appwrite/Utopia/Response/Model/File.php index 750a721f92..a04d9d3b7b 100644 --- a/src/Appwrite/Utopia/Response/Model/File.php +++ b/src/Appwrite/Utopia/Response/Model/File.php @@ -26,13 +26,13 @@ class File extends Model 'type' => self::TYPE_DATETIME, 'description' => 'File creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'File update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$read', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Func.php b/src/Appwrite/Utopia/Response/Model/Func.php index 37484acab7..05384782e4 100644 --- a/src/Appwrite/Utopia/Response/Model/Func.php +++ b/src/Appwrite/Utopia/Response/Model/Func.php @@ -22,13 +22,13 @@ class Func extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Function creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Function update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('execute', [ 'type' => self::TYPE_STRING, @@ -84,13 +84,13 @@ class Func extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Function next scheduled execution date in Datetime.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('schedulePrevious', [ 'type' => self::TYPE_DATETIME, 'description' => 'Function Previous scheduled execution date in Datetime.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('timeout', [ 'type' => self::TYPE_INTEGER, diff --git a/src/Appwrite/Utopia/Response/Model/Key.php b/src/Appwrite/Utopia/Response/Model/Key.php index c52311c328..5ab8be21ea 100644 --- a/src/Appwrite/Utopia/Response/Model/Key.php +++ b/src/Appwrite/Utopia/Response/Model/Key.php @@ -25,13 +25,13 @@ class Key extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Key creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Key update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, @@ -43,7 +43,7 @@ class Key extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Key expiration date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('scopes', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Log.php b/src/Appwrite/Utopia/Response/Model/Log.php index 835cb3d9e3..a1b3b1c451 100644 --- a/src/Appwrite/Utopia/Response/Model/Log.php +++ b/src/Appwrite/Utopia/Response/Model/Log.php @@ -50,7 +50,7 @@ class Log extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Log creation date in Datetime.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('osCode', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Membership.php b/src/Appwrite/Utopia/Response/Model/Membership.php index 547b8db3d7..55bda1c6be 100644 --- a/src/Appwrite/Utopia/Response/Model/Membership.php +++ b/src/Appwrite/Utopia/Response/Model/Membership.php @@ -20,13 +20,13 @@ class Membership extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Membership creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Membership update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('userId', [ 'type' => self::TYPE_STRING, @@ -62,13 +62,13 @@ class Membership extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Date, the user has been invited to join the team in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('joined', [ 'type' => self::TYPE_DATETIME, 'description' => 'Date, the user has accepted the invitation to join the team in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('confirm', [ 'type' => self::TYPE_BOOLEAN, diff --git a/src/Appwrite/Utopia/Response/Model/Platform.php b/src/Appwrite/Utopia/Response/Model/Platform.php index b99ac2011d..5b56601c1b 100644 --- a/src/Appwrite/Utopia/Response/Model/Platform.php +++ b/src/Appwrite/Utopia/Response/Model/Platform.php @@ -25,13 +25,13 @@ class Platform extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Platform creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Platform update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index 301d15edc8..6e11965527 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -27,13 +27,13 @@ class Project extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Project creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Project update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Session.php b/src/Appwrite/Utopia/Response/Model/Session.php index 86c98f768c..73c78b3c1b 100644 --- a/src/Appwrite/Utopia/Response/Model/Session.php +++ b/src/Appwrite/Utopia/Response/Model/Session.php @@ -20,7 +20,7 @@ class Session extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Session creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('userId', [ 'type' => self::TYPE_STRING, @@ -32,7 +32,7 @@ class Session extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Session expiration date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('provider', [ 'type' => self::TYPE_STRING, @@ -56,7 +56,7 @@ class Session extends Model 'type' => self::TYPE_DATETIME, 'description' => 'The date of when the access token expires in datetime format.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('providerRefreshToken', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Team.php b/src/Appwrite/Utopia/Response/Model/Team.php index 8763bbe814..135b633de9 100644 --- a/src/Appwrite/Utopia/Response/Model/Team.php +++ b/src/Appwrite/Utopia/Response/Model/Team.php @@ -20,13 +20,13 @@ class Team extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Team creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Team update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Token.php b/src/Appwrite/Utopia/Response/Model/Token.php index 1b6ae092a6..5801e6d950 100644 --- a/src/Appwrite/Utopia/Response/Model/Token.php +++ b/src/Appwrite/Utopia/Response/Model/Token.php @@ -20,7 +20,7 @@ class Token extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Token creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('userId', [ 'type' => self::TYPE_STRING, @@ -38,7 +38,7 @@ class Token extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Token expiration date in Unix timestamp.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/User.php b/src/Appwrite/Utopia/Response/Model/User.php index d47fa414de..1e0a5dee2f 100644 --- a/src/Appwrite/Utopia/Response/Model/User.php +++ b/src/Appwrite/Utopia/Response/Model/User.php @@ -21,13 +21,13 @@ class User extends Model 'type' => self::TYPE_DATETIME, 'description' => 'User creation date in Datetime.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'User update date in Datetime.', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, @@ -39,7 +39,7 @@ class User extends Model 'type' => self::TYPE_DATETIME, 'description' => 'User registration date in Datetime.', 'default' => null, - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('status', [ 'type' => self::TYPE_BOOLEAN, @@ -51,7 +51,7 @@ class User extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Datetime of the most recent password update', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('email', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Webhook.php b/src/Appwrite/Utopia/Response/Model/Webhook.php index 5aec6bdbe1..88a9ac4869 100644 --- a/src/Appwrite/Utopia/Response/Model/Webhook.php +++ b/src/Appwrite/Utopia/Response/Model/Webhook.php @@ -25,13 +25,13 @@ class Webhook extends Model 'type' => self::TYPE_DATETIME, 'description' => 'Webhook creation date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('$updatedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Webhook update date in Datetime', 'default' => '', - 'example' => '1975-12-06 13:30:59', + 'example' => self::TYPE_DATETIME_EXAMPLE, ]) ->addRule('name', [ 'type' => self::TYPE_STRING, From 74ae43b0921e13dd2111399d3de1dcdaf0c8e168 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 14 Aug 2022 16:56:55 +0300 Subject: [PATCH 3/3] global const for TYPE_DATETIME_EXAMPLE change value --- src/Appwrite/Utopia/Response/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Model.php b/src/Appwrite/Utopia/Response/Model.php index 1a37bed22f..ec97c3a914 100644 --- a/src/Appwrite/Utopia/Response/Model.php +++ b/src/Appwrite/Utopia/Response/Model.php @@ -12,7 +12,7 @@ abstract class Model public const TYPE_BOOLEAN = 'boolean'; public const TYPE_JSON = 'json'; public const TYPE_DATETIME = 'datetime'; - public const TYPE_DATETIME_EXAMPLE = '2020-10-15 09:38:00+03:00'; + public const TYPE_DATETIME_EXAMPLE = '2020-10-15T06:38:00.000Z'; /** * @var bool