added tableid and collectionid in increment and decrement

This commit is contained in:
ArnabChatterjee20k
2025-12-13 23:43:51 +05:30
parent 7d2a95c573
commit 70395cfacc
5 changed files with 7 additions and 1 deletions
@@ -177,6 +177,7 @@ class Decrement extends Action
value: $value,
min: $min
);
$document->setAttribute('$' . $this->getCollectionsEventsContext() . 'Id', $collectionId);
} catch (ConflictException) {
throw new Exception($this->getConflictException());
} catch (NotFoundException) {
@@ -177,6 +177,7 @@ class Increment extends Action
value: $value,
max: $max
);
$document->setAttribute('$' . $this->getCollectionsEventsContext() . 'Id', $collectionId);
} catch (ConflictException) {
throw new Exception($this->getConflictException());
} catch (NotFoundException) {
@@ -82,7 +82,7 @@ class Document extends Any
{
$document->removeAttribute('$collection');
$document->removeAttribute('$tenant');
var_dump($document->getArrayCopy());
if (!$document->isEmpty()) {
$document->setAttribute('$sequence', (int)$document->getAttribute('$sequence', 0));
}
@@ -6118,6 +6118,7 @@ trait DatabasesBase
]));
$this->assertEquals(200, $inc['headers']['status-code']);
$this->assertEquals(6, $inc['body']['count']);
$this->assertEquals($collectionId, $inc['body']['$collectionId']);
// Verify count = 6
$get = $this->client->call(Client::METHOD_GET, "/databases/$databaseId/collections/$collectionId/documents/$docId", array_merge([
@@ -6229,6 +6230,7 @@ trait DatabasesBase
]));
$this->assertEquals(200, $dec['headers']['status-code']);
$this->assertEquals(9, $dec['body']['count']);
$this->assertEquals($collectionId, $dec['body']['$collectionId']);
$get = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $documentId, array_merge([
'content-type' => 'application/json',
@@ -7760,6 +7760,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
]));
$this->assertEquals(200, $inc['headers']['status-code']);
$this->assertEquals($tableId, $inc['body']['$tableId']);
$this->assertEquals(6, $inc['body']['count']);
// Verify count = 6
@@ -7872,6 +7873,7 @@ trait DatabasesBase
]));
$this->assertEquals(200, $dec['headers']['status-code']);
$this->assertEquals(9, $dec['body']['count']);
$this->assertEquals($tableId, $dec['body']['$tableId']);
$get = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows/' . $rowId, array_merge([
'content-type' => 'application/json',