From 85656f81a5dacd1bb7889622a93881aa5d08884c Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 15 Dec 2024 10:03:52 +0000 Subject: [PATCH] update db name --- .../Modules/DevKeys/Http/DevKeys/CreateKey.php | 12 ++++++------ .../Modules/DevKeys/Http/DevKeys/DeleteKey.php | 14 +++++++------- .../Modules/DevKeys/Http/DevKeys/GetKey.php | 10 +++++----- .../Modules/DevKeys/Http/DevKeys/ListKeys.php | 10 +++++----- .../Modules/DevKeys/Http/DevKeys/UpdateKey.php | 14 +++++++------- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/CreateKey.php b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/CreateKey.php index fd23a9d7eb..a1f4c2a296 100644 --- a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/CreateKey.php +++ b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/CreateKey.php @@ -41,13 +41,13 @@ class CreateKey extends Action ->param('name', null, new Text(128), 'Key name. Max length: 128 chars.') ->param('expire', null, new DatetimeValidator(), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.', false) ->inject('response') - ->inject('dbForConsole') - ->callback(fn ($projectId, $name, $expire, $response, $dbForConsole) => $this->action($projectId, $name, $expire, $response, $dbForConsole)); + ->inject('dbForPlatform') + ->callback(fn ($projectId, $name, $expire, $response, $dbForPlatform) => $this->action($projectId, $name, $expire, $response, $dbForPlatform)); } - public function action(string $projectId, string $name, ?string $expire, Response $response, Database $dbForConsole) + public function action(string $projectId, string $name, ?string $expire, Response $response, Database $dbForPlatform) { - $project = $dbForConsole->getDocument('projects', $projectId); + $project = $dbForPlatform->getDocument('projects', $projectId); if ($project->isEmpty()) { throw new Exception(Exception::PROJECT_NOT_FOUND); @@ -69,9 +69,9 @@ class CreateKey extends Action 'secret' => \bin2hex(\random_bytes(128)), ]); - $key = $dbForConsole->createDocument('devKeys', $key); + $key = $dbForPlatform->createDocument('devKeys', $key); - $dbForConsole->purgeCachedDocument('projects', $project->getId()); + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response ->setStatusCode(Response::STATUS_CODE_CREATED) diff --git a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/DeleteKey.php b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/DeleteKey.php index 44a8a9da3e..0fae2c30aa 100644 --- a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/DeleteKey.php +++ b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/DeleteKey.php @@ -34,20 +34,20 @@ class DeleteKey extends Action ->param('projectId', '', new UID(), 'Project unique ID.') ->param('keyId', '', new UID(), 'Key unique ID.') ->inject('response') - ->inject('dbForConsole') - ->callback(fn ($projectId, $keyId, $response, $dbForConsole) => $this->action($projectId, $keyId, $response, $dbForConsole)); + ->inject('dbForPlatform') + ->callback(fn ($projectId, $keyId, $response, $dbForPlatform) => $this->action($projectId, $keyId, $response, $dbForPlatform)); } - public function action(string $projectId, string $keyId, Response $response, Database $dbForConsole) + public function action(string $projectId, string $keyId, Response $response, Database $dbForPlatform) { - $project = $dbForConsole->getDocument('projects', $projectId); + $project = $dbForPlatform->getDocument('projects', $projectId); if ($project->isEmpty()) { throw new Exception(Exception::PROJECT_NOT_FOUND); } - $key = $dbForConsole->findOne('devKeys', [ + $key = $dbForPlatform->findOne('devKeys', [ Query::equal('$id', [$keyId]), Query::equal('projectInternalId', [$project->getInternalId()]), ]); @@ -56,9 +56,9 @@ class DeleteKey extends Action throw new Exception(Exception::KEY_NOT_FOUND); } - $dbForConsole->deleteDocument('devKeys', $key->getId()); + $dbForPlatform->deleteDocument('devKeys', $key->getId()); - $dbForConsole->purgeCachedDocument('projects', $project->getId()); + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response->noContent(); } diff --git a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/GetKey.php b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/GetKey.php index 93da6ca8b3..4f2a7fa9ca 100644 --- a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/GetKey.php +++ b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/GetKey.php @@ -35,20 +35,20 @@ class GetKey extends Action ->param('projectId', '', new UID(), 'Project unique ID.') ->param('keyId', '', new UID(), 'Key unique ID.') ->inject('response') - ->inject('dbForConsole') - ->callback(fn ($projectId, $keyId, $response, $dbForConsole) => $this->action($projectId, $keyId, $response, $dbForConsole)); + ->inject('dbForPlatform') + ->callback(fn ($projectId, $keyId, $response, $dbForPlatform) => $this->action($projectId, $keyId, $response, $dbForPlatform)); } - public function action(string $projectId, string $keyId, Response $response, Database $dbForConsole) + public function action(string $projectId, string $keyId, Response $response, Database $dbForPlatform) { - $project = $dbForConsole->getDocument('projects', $projectId); + $project = $dbForPlatform->getDocument('projects', $projectId); if ($project->isEmpty()) { throw new Exception(Exception::PROJECT_NOT_FOUND); } - $key = $dbForConsole->findOne('devKeys', [ + $key = $dbForPlatform->findOne('devKeys', [ Query::equal('$id', [$keyId]), Query::equal('projectInternalId', [$project->getInternalId()]), ]); diff --git a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/ListKeys.php b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/ListKeys.php index 2ef7cfa9eb..e9df3167ea 100644 --- a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/ListKeys.php +++ b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/ListKeys.php @@ -35,20 +35,20 @@ class ListKeys extends Action ->label('sdk.response.model', Response::MODEL_DEV_KEY_LIST) ->param('projectId', '', new UID(), 'Project unique ID.') ->inject('response') - ->inject('dbForConsole') - ->callback(fn ($projectId, $response, $dbForConsole) => $this->action($projectId, $response, $dbForConsole)); + ->inject('dbForPlatform') + ->callback(fn ($projectId, $response, $dbForPlatform) => $this->action($projectId, $response, $dbForPlatform)); } - public function action(string $projectId, Response $response, Database $dbForConsole) + public function action(string $projectId, Response $response, Database $dbForPlatform) { - $project = $dbForConsole->getDocument('projects', $projectId); + $project = $dbForPlatform->getDocument('projects', $projectId); if ($project->isEmpty()) { throw new Exception(Exception::PROJECT_NOT_FOUND); } - $keys = $dbForConsole->find('devKeys', [ + $keys = $dbForPlatform->find('devKeys', [ Query::equal('projectInternalId', [$project->getInternalId()]), Query::limit(5000), ]); diff --git a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/UpdateKey.php b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/UpdateKey.php index f56b2ed6d2..6d17429084 100644 --- a/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/UpdateKey.php +++ b/src/Appwrite/Platform/Modules/DevKeys/Http/DevKeys/UpdateKey.php @@ -38,19 +38,19 @@ class UpdateKey extends Action ->param('name', null, new Text(128), 'Key name. Max length: 128 chars.') ->param('expire', null, new DatetimeValidator(), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.') ->inject('response') - ->inject('dbForConsole') - ->callback(fn ($projectId, $keyId, $name, $expire, $response, $dbForConsole) => $this->action($projectId, $keyId, $name, $expire, $response, $dbForConsole)); + ->inject('dbForPlatform') + ->callback(fn ($projectId, $keyId, $name, $expire, $response, $dbForPlatform) => $this->action($projectId, $keyId, $name, $expire, $response, $dbForPlatform)); } - public function action(string $projectId, string $keyId, string $name, ?string $expire, Response $response, Database $dbForConsole) + public function action(string $projectId, string $keyId, string $name, ?string $expire, Response $response, Database $dbForPlatform) { - $project = $dbForConsole->getDocument('projects', $projectId); + $project = $dbForPlatform->getDocument('projects', $projectId); if ($project->isEmpty()) { throw new Exception(Exception::PROJECT_NOT_FOUND); } - $key = $dbForConsole->findOne('devKeys', [ + $key = $dbForPlatform->findOne('devKeys', [ Query::equal('$id', [$keyId]), Query::equal('projectInternalId', [$project->getInternalId()]), ]); @@ -63,9 +63,9 @@ class UpdateKey extends Action ->setAttribute('name', $name) ->setAttribute('expire', $expire); - $dbForConsole->updateDocument('devKeys', $key->getId(), $key); + $dbForPlatform->updateDocument('devKeys', $key->getId(), $key); - $dbForConsole->purgeCachedDocument('projects', $project->getId()); + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response->dynamic($key, Response::MODEL_DEV_KEY); }