mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Merge pull request #10952 from appwrite/issue-tableid
Tableid and Collectionid in increment and decrement routes
This commit is contained in:
commit
80057383e1
4 changed files with 6 additions and 0 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) {
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Reference in a new issue