diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index d7def69464..b3ae17dc91 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -649,6 +649,8 @@ App::get('/v1/users') $total = $dbForProject->count('users', $filterQueries, APP_LIMIT_COUNT); } catch (OrderException $e) { throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } $response->dynamic(new Document([ 'users' => $users, diff --git a/src/Appwrite/GraphQL/Types/Mapper.php b/src/Appwrite/GraphQL/Types/Mapper.php index 3c7915bc96..347642e5a1 100644 --- a/src/Appwrite/GraphQL/Types/Mapper.php +++ b/src/Appwrite/GraphQL/Types/Mapper.php @@ -226,7 +226,7 @@ class Mapper ]; if (!$rule['required']) { - $fields[$escapedKey]['defaultValue'] = $rule['default']; + $fields[$escapedKey]['defaultValue'] = $rule['default'] ?? null; } } diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 8c1602eda4..3221383d70 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -445,7 +445,7 @@ class Builds extends Action Console::execute('rsync -av --exclude \'.git\' ' . \escapeshellarg($tmpTemplateDirectory . '/' . $templateRootDirectory . '/') . ' ' . \escapeshellarg($tmpDirectory . '/' . $rootDirectory), '', $stdout, $stderr); // Commit and push - $exit = Console::execute('git config --global user.email "team@appwrite.io" && git config --global user.name "Appwrite" && cd ' . \escapeshellarg($tmpDirectory) . ' && git add . && git commit -m "Create ' . \escapeshellarg($resource->getAttribute('name', '')) . ' function" && git push origin ' . \escapeshellarg($branchName), '', $stdout, $stderr); + $exit = Console::execute('git config --global user.email "team@appwrite.io" && git config --global user.name "Appwrite" && cd ' . \escapeshellarg($tmpDirectory) . ' && git checkout -b ' . \escapeshellarg($branchName) . ' && git add . && git commit -m "Create ' . \escapeshellarg($resource->getAttribute('name', '')) . ' function" && git push origin ' . \escapeshellarg($branchName), '', $stdout, $stderr); if ($exit !== 0) { throw new \Exception('Unable to push code repository: ' . $stderr); diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index e34691839d..a9a6c6e1db 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -1414,9 +1414,20 @@ trait DatabasesBase $this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']); $this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']); $this->assertEquals($releaseWithDate2['body']['key'], $movies['body']['indexes'][3]['key']); - foreach ($movies['body']['indexes'] as $index) { - $this->assertEquals('available', $index['status']); - } + + $this->assertEventually(function () use ($databaseId, $data) { + $movies = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + foreach ($movies['body']['indexes'] as $index) { + $this->assertEquals('available', $index['status']); + } + + return true; + }, 60000, 500); return $data; } diff --git a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php index e84c760c86..b38b1202c6 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php @@ -1470,9 +1470,24 @@ class DatabasesCustomServerTest extends Scope $this->assertCount(64, $collection['body']['attributes']); $this->assertCount(0, $collection['body']['indexes']); - foreach ($collection['body']['attributes'] as $attribute) { - $this->assertEquals('available', $attribute['status'], 'attribute: ' . $attribute['key']); - } + $this->assertEventually(function () use ($databaseId, $collectionId) { + $collection = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + foreach ($collection['body']['attributes'] ?? [] as $attribute) { + $this->assertEquals( + 'available', + $attribute['status'], + 'attribute: ' . $attribute['key'] + ); + } + + return true; + }, 60000, 500); + // Test indexLimit = 64 // MariaDB, MySQL, and MongoDB create 6 indexes per new collection