mirror of
https://github.com/appwrite/appwrite
synced 2026-05-06 06:48:22 +00:00
fix: deletes worker deleting projects with console team
This commit is contained in:
parent
c077636d40
commit
700abb3e47
1 changed files with 21 additions and 0 deletions
|
|
@ -58,6 +58,9 @@ class DeletesV1 extends Worker
|
|||
break;
|
||||
case DELETE_TYPE_TEAMS:
|
||||
$this->deleteMemberships($document, $project->getId());
|
||||
if ($project->getId() === 'console') {
|
||||
$this->deleteProjectsByTeam($document);
|
||||
}
|
||||
break;
|
||||
case DELETE_TYPE_BUCKETS:
|
||||
$this->deleteBucket($document, $project->getId());
|
||||
|
|
@ -263,6 +266,24 @@ class DeletesV1 extends Worker
|
|||
], $this->getProjectDB($projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Utopia\Database\Document $document
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function deleteProjectsByTeam(Document $document): void
|
||||
{
|
||||
$dbForConsole = $this->getConsoleDB();
|
||||
|
||||
$projects = $dbForConsole->find('projects', [
|
||||
Query::equal('teamInternalId', [$document->getInternalId()])
|
||||
]);
|
||||
|
||||
foreach ($projects as $project) {
|
||||
$this->deleteProject($project);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Document $document project document
|
||||
* @throws Exception
|
||||
|
|
|
|||
Loading…
Reference in a new issue