From 237263a194fc68385bbc0f56e54d496735abbf6e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 15 Aug 2025 02:01:44 +1200 Subject: [PATCH] Lint --- .../Collections/Documents/Attribute/Decrement.php | 4 ++-- .../Databases/Collections/Documents/Bulk/Update.php | 2 +- .../Http/Databases/Collections/Documents/Create.php | 4 ++-- .../Modules/Databases/Http/Transactions/Create.php | 2 +- .../Modules/Databases/Http/Transactions/Delete.php | 2 +- .../Modules/Databases/Http/Transactions/Get.php | 2 +- .../Databases/Http/Transactions/Operations/Create.php | 2 +- .../Modules/Databases/Http/Transactions/Update.php | 11 +++++------ .../Modules/Databases/Http/Transactions/XList.php | 2 +- 9 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php index 1a6a7477af..7f67889a1c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php @@ -87,12 +87,12 @@ class Decrement extends Action public function action(string $databaseId, string $collectionId, string $documentId, string $attribute, int|float $value, int|float|null $min, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents, StatsUsage $queueForStatsUsage, array $plan): void { - $database = Authorization::skip(fn() => $dbForProject->getDocument('databases', $databaseId)); + $database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); if ($database->isEmpty()) { throw new Exception(Exception::DATABASE_NOT_FOUND); } - $collection = Authorization::skip(fn() => $dbForProject->getDocument('database_' . $database->getSequence(), $collectionId)); + $collection = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getSequence(), $collectionId)); if ($collection->isEmpty()) { throw new Exception($this->getParentNotFoundException()); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php index caaeaced1a..c198e9cc7b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php @@ -109,7 +109,7 @@ class Update extends Action $hasRelationships = \array_filter( $collection->getAttribute('attributes', []), - fn($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP + fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP ); if ($hasRelationships) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php index 6c9a7ee228..d4a7e2cfda 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php @@ -402,7 +402,7 @@ class Create extends Action 'databaseInternalId' => $database->getSequence(), 'collectionInternalId' => $collection->getSequence(), 'transactionInternalId' => $transaction->getSequence(), - 'documentId' => $isBulk ? null: $documentId, + 'documentId' => $isBulk ? null : $documentId, 'action' => $isBulk ? 'bulkCreate' : 'create', 'data' => $isBulk ? $documents : $documents[0], ]); @@ -476,7 +476,7 @@ class Create extends Action ->addMetric(str_replace('{databaseInternalId}', $database->getSequence(), METRIC_DATABASE_ID_OPERATIONS_WRITES), \max(1, $operations)); // per collection $response->setStatusCode(SwooleResponse::STATUS_CODE_CREATED); - + if ($isBulk) { $response->dynamic(new Document([ 'total' => count($documents), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Create.php index 25a16e19e3..2c98565568 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Create.php @@ -69,4 +69,4 @@ class Create extends Action ->setStatusCode(SwooleResponse::STATUS_CODE_CREATED) ->dynamic($transaction, UtopiaResponse::MODEL_TRANSACTION); } -} \ No newline at end of file +} diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Delete.php index ae6f41fb2d..511f1140bd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Delete.php @@ -73,4 +73,4 @@ class Delete extends Action $response->noContent(); } -} \ No newline at end of file +} diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Get.php index 1a8286e658..12b8629b6a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Get.php @@ -66,4 +66,4 @@ class Get extends Action ->setStatusCode(SwooleResponse::STATUS_CODE_OK) ->dynamic($transaction, UtopiaResponse::MODEL_TRANSACTION); } -} \ No newline at end of file +} diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Operations/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Operations/Create.php index 74f6337751..eac2b930eb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Operations/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Operations/Create.php @@ -114,4 +114,4 @@ class Create extends Action ->setStatusCode(SwooleResponse::STATUS_CODE_CREATED) ->dynamic($transaction, UtopiaResponse::MODEL_TRANSACTION); } -} \ No newline at end of file +} diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Update.php index 27251f3fd9..4775fd06c9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/Update.php @@ -15,7 +15,6 @@ use Utopia\Database\Document; use Utopia\Database\Exception\Conflict as ConflictException; use Utopia\Database\Exception\Duplicate as DuplicateException; use Utopia\Database\Exception\Transaction as TransactionException; -use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\Database\Validator\UID; use Utopia\Swoole\Response as SwooleResponse; @@ -127,11 +126,11 @@ class Update extends Action $document = new Document($data); $dbForProject->createOrUpdateDocuments($collectionId, [$document]); break; - + case 'delete': $dbForProject->deleteDocument($collectionId, $documentId); break; - + case 'increment': $dbForProject->increaseDocumentAttribute( collection: $collectionId, @@ -141,7 +140,7 @@ class Update extends Action max: $data['max'] ?? null ); break; - + case 'decrement': $dbForProject->decreaseDocumentAttribute( collection: $collectionId, @@ -175,7 +174,7 @@ class Update extends Action } $dbForProject->createOrUpdateDocuments($collectionId, $documents); break; - + case 'bulkDelete': $dbForProject->deleteDocuments( $collectionId, @@ -224,4 +223,4 @@ class Update extends Action ->setStatusCode(SwooleResponse::STATUS_CODE_OK) ->dynamic($transaction, UtopiaResponse::MODEL_TRANSACTION); } -} \ No newline at end of file +} diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/XList.php index ee58807d6f..bf8a33a793 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Transactions/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Transactions/XList.php @@ -70,4 +70,4 @@ class XList extends Action 'total' => $dbForProject->count('transactions', $queries), ]), UtopiaResponse::MODEL_TRANSACTION_LIST); } -} \ No newline at end of file +}