1
0
Fork 0
mirror of synced 2024-10-03 19:53:33 +13:00

Fix delete callback

This commit is contained in:
Jake Barnby 2024-01-15 19:00:41 +13:00
parent 1666ba1645
commit f25dd32767
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -192,11 +192,22 @@ class Deletes extends Action
return;
}
$function = $getProjectDB($project)->getDocument('functions', $document->getAttribute('resourceId'));
$resource = $getProjectDB($project)->getDocument(
$document->getAttribute('resourceCollection'),
$document->getAttribute('resourceId')
);
if ($function->isEmpty()) {
$delete = true;
switch ($document->getAttribute('resourceType')) {
case 'function':
$delete = $resource->isEmpty();
break;
}
if ($delete) {
$dbForConsole->deleteDocument('schedules', $document->getId());
Console::success('Deleting schedule for function ' . $document->getAttribute('resourceId'));
Console::success('Deleting schedule for ' . $document->getAttribute('resourceType') . ' ' . $document->getAttribute('resourceId'));
}
}
);