fix: delete schedule document if project is deleted as well

This commit is contained in:
Christy Jacob
2023-07-18 10:10:56 +00:00
parent b4ce4c7837
commit 05f314e88c
2 changed files with 15 additions and 14 deletions
+3 -2
View File
@@ -147,7 +147,8 @@ class DeletesV1 extends Worker
$project = $this->getConsoleDB()->getDocument('projects', $document->getAttribute('projectId'));
if ($project->isEmpty()) {
Console::warning('Unable to delete schedule for function ' . $document->getAttribute('resourceId'));
$this->getConsoleDB()->deleteDocument('schedules', $document->getId());
Console::success('Deleted schedule for deleted project ' . $document->getAttribute('projectId'));
return;
}
@@ -155,7 +156,7 @@ class DeletesV1 extends Worker
if ($function->isEmpty()) {
$this->getConsoleDB()->deleteDocument('schedules', $document->getId());
Console::success('Deleting schedule for function ' . $document->getAttribute('resourceId'));
Console::success('Deleted schedule for function ' . $document->getAttribute('resourceId'));
}
}
);