mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Replace resourceCollection with switch
This commit is contained in:
@@ -64,8 +64,13 @@ abstract class ScheduleBase extends Action
|
||||
$getSchedule = function (Document $schedule) use ($dbForConsole, $getProjectDB): array {
|
||||
$project = $dbForConsole->getDocument('projects', $schedule->getAttribute('projectId'));
|
||||
|
||||
$collectionId = match ($schedule->getAttribute('resourceType')) {
|
||||
'function' => 'functions',
|
||||
'message' => 'messages'
|
||||
};
|
||||
|
||||
$resource = $getProjectDB($project)->getDocument(
|
||||
$schedule->getAttribute('resourceCollection'),
|
||||
$collectionId,
|
||||
$schedule->getAttribute('resourceId')
|
||||
);
|
||||
|
||||
@@ -108,7 +113,12 @@ abstract class ScheduleBase extends Action
|
||||
try {
|
||||
$this->schedules[$document['resourceId']] = $getSchedule($document);
|
||||
} catch (\Throwable $th) {
|
||||
Console::error("Failed to load schedule for project {$document['projectId']} {$document['resourceCollection']} {$document['resourceId']}");
|
||||
$collectionId = match ($document->getAttribute('resourceType')) {
|
||||
'function' => 'functions',
|
||||
'message' => 'messages'
|
||||
};
|
||||
|
||||
Console::error("Failed to load schedule for project {$document['projectId']} {$collectionId} {$document['resourceId']}");
|
||||
Console::error($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +203,13 @@ class Deletes extends Action
|
||||
return;
|
||||
}
|
||||
|
||||
$collectionId = match ($document->getAttribute('resourceType')) {
|
||||
'function' => 'functions',
|
||||
'message' => 'messages'
|
||||
};
|
||||
|
||||
$resource = $getProjectDB($project)->getDocument(
|
||||
$document->getAttribute('resourceCollection'),
|
||||
$collectionId,
|
||||
$document->getAttribute('resourceId')
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user