From 0a72b37b3ea557c900feff6655b8af976c35cd07 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 6 Feb 2024 02:17:04 +1300 Subject: [PATCH 1/2] Fix session response model --- app/config/collections.php | 2 +- app/controllers/api/account.php | 2 +- src/Appwrite/Utopia/Response/Model/Session.php | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index bd379b0cce..6844f8c719 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -893,7 +893,7 @@ $commonCollections = [ 'signed' => true, 'required' => false, 'default' => new \stdClass(), - 'array' => true, + 'array' => false, 'filters' => ['json'], ], [ diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 5b56f722b6..49eabcbf5c 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -203,7 +203,7 @@ App::post('/v1/account/sessions/email') ->label('audits.userId', '{response.userId}') ->label('sdk.auth', []) ->label('sdk.namespace', 'account') - ->label('sdk.method', ['createEmailPasswordSession', 'createEmailSession']) + ->label('sdk.method', 'createEmailPasswordSession') ->label('sdk.description', '/docs/references/account/create-session-email-password.md') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) diff --git a/src/Appwrite/Utopia/Response/Model/Session.php b/src/Appwrite/Utopia/Response/Model/Session.php index b1e41e5419..cb01157bae 100644 --- a/src/Appwrite/Utopia/Response/Model/Session.php +++ b/src/Appwrite/Utopia/Response/Model/Session.php @@ -161,10 +161,11 @@ class Session extends Model 'example' => true, ]) ->addRule('factors', [ - 'type' => self::TYPE_INTEGER, + 'type' => self::TYPE_STRING, 'description' => 'Returns a list of active session factors.', - 'default' => 1, - 'example' => 1, + 'default' => [], + 'example' => ['email'], + 'array' => true, ]) ->addRule('secret', [ 'type' => self::TYPE_STRING, From 987b02083c4d55d5e4076275a0dd69c9104e11c8 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 6 Feb 2024 02:22:25 +1300 Subject: [PATCH 2/2] Array instead of JSON --- app/config/collections.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index 6844f8c719..d1bb04756e 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -892,9 +892,9 @@ $commonCollections = [ 'size' => 256, 'signed' => true, 'required' => false, - 'default' => new \stdClass(), - 'array' => false, - 'filters' => ['json'], + 'default' => [], + 'array' => true, + 'filters' => [], ], [ '$id' => ID::custom('expire'),