mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Remove redundant order
This commit is contained in:
parent
84bf2641aa
commit
3a7d8d2296
1 changed files with 4 additions and 6 deletions
|
|
@ -57,14 +57,13 @@ class Update extends Action
|
||||||
->param('transactionId', '', new UID(), 'Transaction ID.')
|
->param('transactionId', '', new UID(), 'Transaction ID.')
|
||||||
->param('commit', false, new Boolean(), 'Commit transaction?', true)
|
->param('commit', false, new Boolean(), 'Commit transaction?', true)
|
||||||
->param('rollback', false, new Boolean(), 'Rollback transaction?', true)
|
->param('rollback', false, new Boolean(), 'Rollback transaction?', true)
|
||||||
->inject('requestTimestamp')
|
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->inject('project')
|
->inject('queueForDeletes')
|
||||||
->callback($this->action(...));
|
->callback($this->action(...));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function action(string $transactionId, bool $commit, bool $rollback, ?\DateTime $requestTimestamp, UtopiaResponse $response, Database $dbForProject, Document $project): void
|
public function action(string $transactionId, bool $commit, bool $rollback, UtopiaResponse $response, Database $dbForProject, Delete $queueForDeletes): void
|
||||||
{
|
{
|
||||||
if (!$commit && !$rollback) {
|
if (!$commit && !$rollback) {
|
||||||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Either commit or rollback must be true');
|
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Either commit or rollback must be true');
|
||||||
|
|
@ -88,15 +87,14 @@ class Update extends Action
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($commit) {
|
if ($commit) {
|
||||||
$dbForProject->withTransaction(function () use ($dbForProject, $transactionId, $transaction, $requestTimestamp) {
|
$dbForProject->withTransaction(function () use ($dbForProject, $queueForDeletes, $transactionId, $transaction) {
|
||||||
$dbForProject->updateDocument('transactions', $transactionId, new Document([
|
$dbForProject->updateDocument('transactions', $transactionId, new Document([
|
||||||
'status' => 'committing',
|
'status' => 'committing',
|
||||||
]));
|
]));
|
||||||
|
|
||||||
// Fetch operations ordered by creation time to maintain exact sequence
|
// Fetch operations ordered by sequence by default
|
||||||
$operations = $dbForProject->find('transactionLogs', [
|
$operations = $dbForProject->find('transactionLogs', [
|
||||||
Query::equal('transactionInternalId', [$transaction->getSequence()]),
|
Query::equal('transactionInternalId', [$transaction->getSequence()]),
|
||||||
Query::orderAsc('$createdAt'),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue