mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Check expiry on stage
This commit is contained in:
parent
a3103bf4d4
commit
32d6eaa21c
7 changed files with 42 additions and 0 deletions
|
|
@ -105,6 +105,12 @@ class Decrement extends Action
|
|||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Invalid or non‑pending transaction');
|
||||
}
|
||||
|
||||
$now = new \DateTime();
|
||||
$expiresAt = new \DateTime($transaction->getAttribute('expiresAt', 'now'));
|
||||
if ($now > $expiresAt) {
|
||||
throw new Exception(Exception::TRANSACTION_EXPIRED);
|
||||
}
|
||||
|
||||
// Enforce max operations per transaction
|
||||
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
|
||||
$existing = $transaction->getAttribute('operations', 0);
|
||||
|
|
|
|||
|
|
@ -105,6 +105,12 @@ class Increment extends Action
|
|||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Invalid or non‑pending transaction');
|
||||
}
|
||||
|
||||
$now = new \DateTime();
|
||||
$expiresAt = new \DateTime($transaction->getAttribute('expiresAt', 'now'));
|
||||
if ($now > $expiresAt) {
|
||||
throw new Exception(Exception::TRANSACTION_EXPIRED);
|
||||
}
|
||||
|
||||
// Enforce max operations per transaction
|
||||
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
|
||||
$existing = $transaction->getAttribute('operations', 0);
|
||||
|
|
|
|||
|
|
@ -375,6 +375,12 @@ class Create extends Action
|
|||
throw new Exception(Exception::TRANSACTION_NOT_READY);
|
||||
}
|
||||
|
||||
$now = new \DateTime();
|
||||
$expiresAt = new \DateTime($transaction->getAttribute('expiresAt', 'now'));
|
||||
if ($now > $expiresAt) {
|
||||
throw new Exception(Exception::TRANSACTION_EXPIRED);
|
||||
}
|
||||
|
||||
// Enforce max operations per transaction
|
||||
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
|
||||
$existing = $transaction->getAttribute('operations', 0);
|
||||
|
|
|
|||
|
|
@ -137,6 +137,12 @@ class Delete extends Action
|
|||
throw new Exception(Exception::TRANSACTION_NOT_READY);
|
||||
}
|
||||
|
||||
$now = new \DateTime();
|
||||
$expiresAt = new \DateTime($transaction->getAttribute('expiresAt', 'now'));
|
||||
if ($now > $expiresAt) {
|
||||
throw new Exception(Exception::TRANSACTION_EXPIRED);
|
||||
}
|
||||
|
||||
// Enforce max operations per transaction
|
||||
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
|
||||
$existing = $transaction->getAttribute('operations', 0);
|
||||
|
|
|
|||
|
|
@ -252,6 +252,12 @@ class Update extends Action
|
|||
throw new Exception(Exception::TRANSACTION_NOT_READY);
|
||||
}
|
||||
|
||||
$now = new \DateTime();
|
||||
$expiresAt = new \DateTime($transaction->getAttribute('expiresAt', 'now'));
|
||||
if ($now > $expiresAt) {
|
||||
throw new Exception(Exception::TRANSACTION_EXPIRED);
|
||||
}
|
||||
|
||||
// Enforce max operations per transaction
|
||||
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
|
||||
$existing = $transaction->getAttribute('operations', 0);
|
||||
|
|
|
|||
|
|
@ -261,6 +261,12 @@ class Upsert extends Action
|
|||
throw new Exception(Exception::TRANSACTION_NOT_READY);
|
||||
}
|
||||
|
||||
$now = new \DateTime();
|
||||
$expiresAt = new \DateTime($transaction->getAttribute('expiresAt', 'now'));
|
||||
if ($now > $expiresAt) {
|
||||
throw new Exception(Exception::TRANSACTION_EXPIRED);
|
||||
}
|
||||
|
||||
// Enforce max operations per transaction
|
||||
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
|
||||
$existing = $transaction->getAttribute('operations', 0);
|
||||
|
|
|
|||
|
|
@ -77,6 +77,12 @@ class Create extends Action
|
|||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Invalid or non‑pending transaction');
|
||||
}
|
||||
|
||||
$now = new \DateTime();
|
||||
$expiresAt = new \DateTime($transaction->getAttribute('expiresAt', 'now'));
|
||||
if ($now > $expiresAt) {
|
||||
throw new Exception(Exception::TRANSACTION_EXPIRED);
|
||||
}
|
||||
|
||||
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
|
||||
$existing = $transaction->getAttribute('operations', 0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue