mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 08:28:42 +00:00
Lint
This commit is contained in:
parent
ef8d1b525d
commit
237263a194
9 changed files with 15 additions and 16 deletions
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -69,4 +69,4 @@ class Create extends Action
|
|||
->setStatusCode(SwooleResponse::STATUS_CODE_CREATED)
|
||||
->dynamic($transaction, UtopiaResponse::MODEL_TRANSACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,4 +73,4 @@ class Delete extends Action
|
|||
|
||||
$response->noContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,4 +66,4 @@ class Get extends Action
|
|||
->setStatusCode(SwooleResponse::STATUS_CODE_OK)
|
||||
->dynamic($transaction, UtopiaResponse::MODEL_TRANSACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,4 +114,4 @@ class Create extends Action
|
|||
->setStatusCode(SwooleResponse::STATUS_CODE_CREATED)
|
||||
->dynamic($transaction, UtopiaResponse::MODEL_TRANSACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,4 +70,4 @@ class XList extends Action
|
|||
'total' => $dbForProject->count('transactions', $queries),
|
||||
]), UtopiaResponse::MODEL_TRANSACTION_LIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue