Merge pull request #10480 from appwrite/spatial-type-attributes

Bump database
This commit is contained in:
Jake Barnby 2025-09-12 19:02:46 +12:00 committed by GitHub
commit 918912c0b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 25 deletions

12
composer.lock generated
View file

@ -3638,16 +3638,16 @@
},
{
"name": "utopia-php/database",
"version": "1.4.7",
"version": "1.4.8",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "45009951765c5c6ec7ee42b740cf8a846ea3ccd2"
"reference": "dbecdf89fde33a5f81ec19f4f97fe0c3715dc83a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/45009951765c5c6ec7ee42b740cf8a846ea3ccd2",
"reference": "45009951765c5c6ec7ee42b740cf8a846ea3ccd2",
"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.7"
"source": "https://github.com/utopia-php/database/tree/1.4.8"
},
"time": "2025-09-11T12:40:31+00:00"
"time": "2025-09-12T03:35:59+00:00"
},
{
"name": "utopia-php/detector",

View file

@ -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',

View file

@ -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']);
}

View file

@ -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]]]
],
[

View file

@ -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']);
}