mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
update: if/else > switch > match
This commit is contained in:
+5
-11
@@ -106,18 +106,12 @@ class XList extends Action
|
||||
]);
|
||||
|
||||
$audit = new Audit($dbForProject);
|
||||
$isRows = $this->getContext() === ROWS;
|
||||
|
||||
// returns what we want, ignore the naming!
|
||||
$type = $this->getCollectionsEventsContext();
|
||||
$item = $isRows ? 'row' : 'document';
|
||||
|
||||
if (!$isRows) {
|
||||
$resource = "database/$databaseId/$type/$collectionId/$item/{$document->getId()}";
|
||||
} else {
|
||||
// grid
|
||||
$resource = "database/$databaseId/grid/$type/$collectionId/$item/{$document->getId()}";
|
||||
}
|
||||
$context = $this->getContext();
|
||||
$resource = match ($context) {
|
||||
ROWS => "database/$databaseId/grid/$type/$collectionId/$context/{$document->getId()}",
|
||||
default => "database/$databaseId/$type/$collectionId/$context/{$document->getId()}",
|
||||
};
|
||||
|
||||
$logs = $audit->getLogsByResource($resource, $queries);
|
||||
|
||||
|
||||
@@ -103,15 +103,11 @@ class XList extends Action
|
||||
]);
|
||||
|
||||
$audit = new Audit($dbForProject);
|
||||
|
||||
$context = $this->getContext();
|
||||
$isTables = $context === TABLES;
|
||||
|
||||
if (!$isTables) {
|
||||
$resource = "database/$databaseId/$context/$collectionId";
|
||||
} else {
|
||||
$resource = "database/$databaseId/grid/$context/$collectionId";
|
||||
}
|
||||
$resource = match ($context) {
|
||||
TABLES => "database/$databaseId/grid/$context/$collectionId",
|
||||
default => "database/$databaseId/$context/$collectionId",
|
||||
};
|
||||
|
||||
$logs = $audit->getLogsByResource($resource, $queries);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user