From f749256e03304e7137b441cd1937f9b34f6bdd2e Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 16 Jul 2021 09:33:30 -0400 Subject: [PATCH 1/6] Fix typos in changes for certificates worker --- app/config/collections2.php | 2 +- app/controllers/general.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/collections2.php b/app/config/collections2.php index 0a69b81c32..2e0bf087d5 100644 --- a/app/config/collections2.php +++ b/app/config/collections2.php @@ -1051,7 +1051,7 @@ $collections = [ '$collection' => Database::COLLECTIONS, '$id' => 'certificates', 'name' => 'Certificates', - 'attributes' => [, + 'attributes' => [ [ '$id' => 'domain', 'type' => Database::VAR_STRING, diff --git a/app/controllers/general.php b/app/controllers/general.php index 8b599a44c7..cfe06effb1 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -281,7 +281,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $dbForCons throw new Exception('Password reset is required', 412); } -}, ['utopia', 'request', 'response', 'console', 'project', 'consoleDB', 'user', 'locale', 'clients']); +}, ['utopia', 'request', 'response', 'console', 'project', 'dbForConsole', 'user', 'locale', 'clients']); App::options(function ($request, $response) { /** @var Utopia\Swoole\Request $request */ From c04e2ba924cf442d800b56091e3dee54d8ecd62b Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 16 Jul 2021 09:49:54 -0400 Subject: [PATCH 2/6] Remove $ from projectId attribute --- app/workers/tasks.php | 2 +- src/Appwrite/Utopia/Response/Model/Task.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/workers/tasks.php b/app/workers/tasks.php index 287aea5faa..cb24c65a9f 100644 --- a/app/workers/tasks.php +++ b/app/workers/tasks.php @@ -33,7 +33,7 @@ class TasksV1 extends Worker $db = $register->get('db'); $cache = $register->get('cache'); - $projectId = $this->args['$projectId'] ?? null; + $projectId = $this->args['projectId'] ?? null; $taskId = $this->args['$id'] ?? null; $updated = $this->args['updated'] ?? null; $next = $this->args['next'] ?? null; diff --git a/src/Appwrite/Utopia/Response/Model/Task.php b/src/Appwrite/Utopia/Response/Model/Task.php index 974bd4bafb..fa5816ed15 100644 --- a/src/Appwrite/Utopia/Response/Model/Task.php +++ b/src/Appwrite/Utopia/Response/Model/Task.php @@ -21,7 +21,7 @@ class Task extends Model 'default' => '', 'example' => '5e5ea5c16897e', ]) - ->addRule('$projectId', [ + ->addRule('projectId', [ 'type' => self::TYPE_STRING, 'description' => 'Project ID.', 'default' => '', From 78dd02e81d58a88df4d7658a2c470003505cb752 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 16 Jul 2021 09:50:25 -0400 Subject: [PATCH 3/6] Revert increased curl timeout --- tests/e2e/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index 3bf4b164d9..82fd642a08 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -189,7 +189,7 @@ class Client curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); - curl_setopt($ch, CURLOPT_TIMEOUT, 60); + curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders) { $len = strlen($header); $header = explode(':', $header, 2); From 2619157dd0cc09b52a3644a5f97f5a800a197536 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 16 Jul 2021 09:53:55 -0400 Subject: [PATCH 4/6] Add inline todos --- app/controllers/api/database.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 2dc9d149da..87d70167d1 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -237,8 +237,11 @@ App::post('/v1/database/collections/:collectionId/attributes') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE) ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') + // TODO@kodumbeats attributeId ->param('id', '', new Key(), 'Attribute ID.') + // TODO@kodumbeats whitelist (allowlist) ->param('type', null, new Text(8), 'Attribute type.') + // TODO@kodumbeats hide size for ints/floats/bools ->param('size', null, new Integer(), 'Attribute size for text attributes, in number of characters. For integers, floats, or bools, use 0.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Wildcard(), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true) @@ -745,6 +748,7 @@ App::get('/v1/database/collections/:collectionId/documents') ->param('queries', [], new ArrayList(new Text(128)), 'Array of query strings.', true) ->param('limit', 25, new Range(0, 100), 'Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('offset', 0, new Range(0, 900000000), 'Offset value. The default value is 0. Use this param to manage pagination.', true) + // TODO@kodumbeats 'after' param for pagination ->param('orderAttributes', [], new ArrayList(new Text(128)), 'Array of attributes used to sort results.', true) ->param('orderTypes', [], new ArrayList(new WhiteList(['DESC', 'ASC'], true)), 'Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order.', true) ->inject('response') From ce742b104e0008ef166f50e72567f9de6ecc3d26 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 16 Jul 2021 10:32:20 -0400 Subject: [PATCH 5/6] Remove $ from task document --- app/controllers/api/projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 6b2591dca2..28694a0b10 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -1006,7 +1006,7 @@ App::post('/v1/projects/:projectId/tasks') $task = new Document([ '$id' => $dbForConsole->getId(), - '$projectId' => $project->getId(), + 'projectId' => $project->getId(), 'name' => $name, 'status' => $status, 'schedule' => $schedule, From 3c475e37a99ea6359eeb6e3b97367eb662bb3f45 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Fri, 16 Jul 2021 10:35:46 -0400 Subject: [PATCH 6/6] Add delay to wait for db before initialization --- app/http.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/http.php b/app/http.php index becb7aa0b0..ee8a073b03 100644 --- a/app/http.php +++ b/app/http.php @@ -69,6 +69,9 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) { return $app; }); + // wait for database to be ready + sleep(5); + $dbForConsole = $app->getResource('dbForConsole'); /** @var Utopia\Database\Database $dbForConsole */ if(!$dbForConsole->exists()) {