mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 08:28:42 +00:00
update: if/else > switch > match
This commit is contained in:
parent
0556f8fdca
commit
bc55639bf7
2 changed files with 9 additions and 19 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue