mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge branch '1.8.x' into fix-dns-flows
This commit is contained in:
@@ -538,7 +538,7 @@ App::get('/v1/health/queue/databases')
|
||||
->inject('response')
|
||||
->action(function (string $name, int|string $threshold, Database $queueForDatabase, Response $response) {
|
||||
$threshold = \intval($threshold);
|
||||
$size = $queueForDatabase->getSize();
|
||||
$size = $queueForDatabase->setQueue($name)->getSize();
|
||||
|
||||
if ($size >= $threshold) {
|
||||
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
|
||||
|
||||
@@ -246,10 +246,11 @@ App::init()
|
||||
$role = $apiKey->getRole();
|
||||
$scopes = $apiKey->getScopes();
|
||||
|
||||
// Disable authorization checks for API keys
|
||||
Authorization::setDefaultStatus(false);
|
||||
|
||||
if ($apiKey->getRole() === Auth::USER_ROLE_APPS) {
|
||||
// Disable authorization checks for API keys
|
||||
Authorization::setDefaultStatus(false);
|
||||
|
||||
$user = new Document([
|
||||
'$id' => '',
|
||||
'status' => true,
|
||||
|
||||
Generated
+6
-6
@@ -3638,16 +3638,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/database",
|
||||
"version": "1.4.6",
|
||||
"version": "1.4.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
"reference": "c7dcfd8a5671944d1a9a454cbf26b95a8bd47544"
|
||||
"reference": "dbecdf89fde33a5f81ec19f4f97fe0c3715dc83a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/c7dcfd8a5671944d1a9a454cbf26b95a8bd47544",
|
||||
"reference": "c7dcfd8a5671944d1a9a454cbf26b95a8bd47544",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/dbecdf89fde33a5f81ec19f4f97fe0c3715dc83a",
|
||||
"reference": "dbecdf89fde33a5f81ec19f4f97fe0c3715dc83a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3688,9 +3688,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/1.4.6"
|
||||
"source": "https://github.com/utopia-php/database/tree/1.4.8"
|
||||
},
|
||||
"time": "2025-09-11T06:01:47+00:00"
|
||||
"time": "2025-09-12T03:35:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/detector",
|
||||
|
||||
+6
-2
@@ -4,5 +4,9 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/appwrite/appwrite.git"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"docs/examples",
|
||||
"app/config/specs"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -161,17 +161,20 @@ class Database extends Event
|
||||
return $this->document;
|
||||
}
|
||||
|
||||
public function getQueue(): string
|
||||
public function setProject(Document $project): self
|
||||
{
|
||||
try {
|
||||
$dsn = new DSN($this->getProject()->getAttribute('database'));
|
||||
} catch (\InvalidArgumentException) {
|
||||
// TODO: Temporary until all projects are using shared tables
|
||||
$dsn = new DSN('mysql://' . $this->getProject()->getAttribute('database'));
|
||||
$database = $project->getAttribute('database');
|
||||
if (!empty($database)) {
|
||||
try {
|
||||
$dsn = new DSN($database);
|
||||
} catch (\InvalidArgumentException) {
|
||||
// TODO: Temporary until all projects are using shared tables
|
||||
$dsn = new DSN("mysql://$database");
|
||||
}
|
||||
$this->queue = $dsn->getHost();
|
||||
}
|
||||
|
||||
$this->queue = $dsn->getHost();
|
||||
return $this->queue;
|
||||
return parent::setProject($project);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5981,12 +5981,12 @@ trait DatabasesBase
|
||||
'documentId' => ID::unique(),
|
||||
'data' => [
|
||||
'name' => 'Upserted Location',
|
||||
'location' => [34.0522, -118.2437] // Los Angeles coordinates
|
||||
'location' => [34.0522, -80] // Los Angeles coordinates
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals([34.0522, -118.2437], $response['body']['location']);
|
||||
$this->assertEquals([34.0522, -80], $response['body']['location']);
|
||||
|
||||
// Test 5: Create document without permissions (should fail)
|
||||
$response = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', [
|
||||
@@ -6116,12 +6116,12 @@ trait DatabasesBase
|
||||
'documentId' => ID::unique(),
|
||||
'data' => [
|
||||
'distance' => 200,
|
||||
'route' => [[34.0522, -118.2437], [34.0736, -118.2400]] // LA route
|
||||
'route' => [[34.0522, -80], [34.0736, -90]] // LA route
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals([[34.0522, -118.2437], [34.0736, -118.2400]], $response['body']['route']);
|
||||
$this->assertEquals([[34.0522, -80], [34.0736, -90]], $response['body']['route']);
|
||||
|
||||
// Test 5: Delete document
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $documentId, array_merge([
|
||||
@@ -6253,12 +6253,12 @@ trait DatabasesBase
|
||||
'documentId' => ID::unique(),
|
||||
'data' => [
|
||||
'active' => false,
|
||||
'area' => [[[34.0522, -118.2437], [34.0736, -118.2437], [34.0736, -118.2400], [34.0522, -118.2400], [34.0522, -118.2437]]] // LA area
|
||||
'area' => [[[34.0522, -80], [34.0736, -80], [34.0736, -90], [34.0522, -90], [34.0522, -80]]] // LA area
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals([[[34.0522, -118.2437], [34.0736, -118.2437], [34.0736, -118.2400], [34.0522, -118.2400], [34.0522, -118.2437]]], $response['body']['area']);
|
||||
$this->assertEquals([[[34.0522, -80], [34.0736, -80], [34.0736, -90], [34.0522, -90], [34.0522, -80]]], $response['body']['area']);
|
||||
|
||||
// Test 5: Create document without required polygon attribute (should fail)
|
||||
$response = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([
|
||||
@@ -6693,7 +6693,7 @@ trait DatabasesBase
|
||||
'$id' => 'doc1',
|
||||
'name' => 'Test Document 1',
|
||||
'pointAttr' => [6.0, 6.0],
|
||||
'lineAttr' => [[1.0, 1.0], [2.0, 2.0]],
|
||||
'lineAttr' => [[1.0, 1.0], [1.1,1.1] , [2.0, 2.0]],
|
||||
'polyAttr' => [[[0.0, 0.0], [10.0, 0.0], [10.0, 10.0], [0.0, 10.0], [0.0, 0.0]]]
|
||||
],
|
||||
[
|
||||
@@ -6775,6 +6775,7 @@ trait DatabasesBase
|
||||
$this->assertCount(1, $response['body']['documents']);
|
||||
$this->assertEquals('doc1', $response['body']['documents'][0]['$id']);
|
||||
|
||||
|
||||
// Test 4.2: notContains on polygon (point outside all polygons)
|
||||
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
|
||||
@@ -6682,7 +6682,7 @@ class DatabasesCustomServerTest extends Scope
|
||||
'path' => [
|
||||
[0, 0],
|
||||
[50, 50],
|
||||
[100, 100]
|
||||
[80, 80]
|
||||
] // New LINE STRING
|
||||
],
|
||||
]);
|
||||
@@ -6696,7 +6696,7 @@ class DatabasesCustomServerTest extends Scope
|
||||
$this->assertEquals([
|
||||
[0, 0],
|
||||
[50, 50],
|
||||
[100, 100]
|
||||
[80, 80]
|
||||
], $document['path']);
|
||||
}
|
||||
|
||||
|
||||
@@ -7615,12 +7615,12 @@ trait DatabasesBase
|
||||
'rowId' => ID::unique(),
|
||||
'data' => [
|
||||
'name' => 'Upserted Location',
|
||||
'location' => [34.0522, -118.2437]
|
||||
'location' => [34.0522, -80]
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals([34.0522, -118.2437], $response['body']['location']);
|
||||
$this->assertEquals([34.0522, -80], $response['body']['location']);
|
||||
|
||||
// Create row without permissions (should fail)
|
||||
$response = $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows', [
|
||||
@@ -7749,12 +7749,12 @@ trait DatabasesBase
|
||||
'rowId' => ID::unique(),
|
||||
'data' => [
|
||||
'distance' => 200,
|
||||
'route' => [[34.0522, -118.2437], [34.0736, -118.2400]]
|
||||
'route' => [[34.0522, -80], [34.0736, -80]]
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals([[34.0522, -118.2437], [34.0736, -118.2400]], $response['body']['route']);
|
||||
$this->assertEquals([[34.0522, -80], [34.0736, -80]], $response['body']['route']);
|
||||
|
||||
// Delete row
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows/' . $rowId, array_merge([
|
||||
@@ -7883,12 +7883,12 @@ trait DatabasesBase
|
||||
'rowId' => ID::unique(),
|
||||
'data' => [
|
||||
'active' => false,
|
||||
'area' => [[[34.0522, -118.2437], [34.0736, -118.2437], [34.0736, -118.2400], [34.0522, -118.2400], [34.0522, -118.2437]]]
|
||||
'area' => [[[34.0522, -80], [34.0736, -80], [34.0736, -80], [34.0522, -80], [34.0522, -80]]]
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals([[[34.0522, -118.2437], [34.0736, -118.2437], [34.0736, -118.2400], [34.0522, -118.2400], [34.0522, -118.2437]]], $response['body']['area']);
|
||||
$this->assertEquals([[[34.0522, -80], [34.0736, -80], [34.0736, -80], [34.0522, -80], [34.0522, -80]]], $response['body']['area']);
|
||||
|
||||
// Create row missing required polygon (should fail)
|
||||
$response = $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows', array_merge([
|
||||
@@ -8158,7 +8158,7 @@ trait DatabasesBase
|
||||
'$id' => 'row1',
|
||||
'name' => 'Test Row 1',
|
||||
'pointAttr' => [6.0, 6.0],
|
||||
'lineAttr' => [[1.0, 1.0], [2.0, 2.0]],
|
||||
'lineAttr' => [[1.0, 1.0], [1.1,1.1] , [2.0, 2.0]],
|
||||
'polyAttr' => [[[0.0, 0.0], [10.0, 0.0], [10.0, 10.0], [0.0, 10.0], [0.0, 0.0]]]
|
||||
],
|
||||
[
|
||||
|
||||
@@ -6379,7 +6379,7 @@ class DatabasesCustomServerTest extends Scope
|
||||
]);
|
||||
|
||||
// Coordinates are not validated strictly; creation should succeed
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
$this->assertEquals(400, $response['headers']['status-code']);
|
||||
|
||||
// Test 4b: Invalid polygon (insufficient points - should fail)
|
||||
$response = $this->client->call(Client::METHOD_POST, "/tablesdb/{$databaseId}/tables/{$tableId}/rows", array_merge([
|
||||
@@ -6650,7 +6650,7 @@ class DatabasesCustomServerTest extends Scope
|
||||
'path' => [
|
||||
[0, 0],
|
||||
[50, 50],
|
||||
[100, 100]
|
||||
[80, 80]
|
||||
] // New LINE STRING
|
||||
],
|
||||
]);
|
||||
@@ -6664,7 +6664,7 @@ class DatabasesCustomServerTest extends Scope
|
||||
$this->assertEquals([
|
||||
[0, 0],
|
||||
[50, 50],
|
||||
[100, 100]
|
||||
[80, 80]
|
||||
], $row['path']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user