mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Fix tests
This commit is contained in:
parent
59ae403391
commit
2bc90db1f6
3 changed files with 9 additions and 5 deletions
|
|
@ -574,25 +574,25 @@ class TransactionState
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Query::TYPE_GREATER_THAN:
|
case Query::TYPE_GREATER:
|
||||||
if (!($docValue > $values[0])) {
|
if (!($docValue > $values[0])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Query::TYPE_GREATER_THAN_EQUAL:
|
case Query::TYPE_GREATER_EQUAL:
|
||||||
if (!($docValue >= $values[0])) {
|
if (!($docValue >= $values[0])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Query::TYPE_LESSER_THAN:
|
case Query::TYPE_LESSER:
|
||||||
if (!($docValue < $values[0])) {
|
if (!($docValue < $values[0])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Query::TYPE_LESSER_THAN_EQUAL:
|
case Query::TYPE_LESSER_EQUAL:
|
||||||
if (!($docValue <= $values[0])) {
|
if (!($docValue <= $values[0])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,10 @@ class Create extends Action
|
||||||
|
|
||||||
public function action(string $transactionId, array $operations, UtopiaResponse $response, Database $dbForProject, array $plan): void
|
public function action(string $transactionId, array $operations, UtopiaResponse $response, Database $dbForProject, array $plan): void
|
||||||
{
|
{
|
||||||
|
if (empty($operations)) {
|
||||||
|
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Operations array cannot be empty');
|
||||||
|
}
|
||||||
|
|
||||||
$transaction = $dbForProject->getDocument('transactions', $transactionId);
|
$transaction = $dbForProject->getDocument('transactions', $transactionId);
|
||||||
if ($transaction->isEmpty() || $transaction->getAttribute('status', '') !== 'pending') {
|
if ($transaction->isEmpty() || $transaction->getAttribute('status', '') !== 'pending') {
|
||||||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Invalid or non‑pending transaction');
|
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Invalid or non‑pending transaction');
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ class Update extends Action
|
||||||
$totalOperations = 0;
|
$totalOperations = 0;
|
||||||
$databaseOperations = [];
|
$databaseOperations = [];
|
||||||
|
|
||||||
$dbForProject->withTransaction(function () use ($dbForProject, $queueForDeletes, $transactionId, &$transaction, &$operations, &$totalOperations, &$databaseOperations, $queueForEvents, $queueForStatsUsage, $queueForRealtime, $queueForFunctions, $queueForWebhooks) {
|
$dbForProject->withTransaction(function () use ($dbForProject, $transactionState, $queueForDeletes, $transactionId, &$transaction, &$operations, &$totalOperations, &$databaseOperations, $queueForEvents, $queueForStatsUsage, $queueForRealtime, $queueForFunctions, $queueForWebhooks) {
|
||||||
$dbForProject->updateDocument('transactions', $transactionId, new Document([
|
$dbForProject->updateDocument('transactions', $transactionId, new Document([
|
||||||
'status' => 'committing',
|
'status' => 'committing',
|
||||||
]));
|
]));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue