mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +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;
|
break;
|
||||||
case DELETE_TYPE_TEAMS:
|
case DELETE_TYPE_TEAMS:
|
||||||
$this->deleteMemberships($document, $project->getId());
|
$this->deleteMemberships($document, $project->getId());
|
||||||
|
if ($project->getId() === 'console') {
|
||||||
|
$this->deleteProjectsByTeam($document);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DELETE_TYPE_BUCKETS:
|
case DELETE_TYPE_BUCKETS:
|
||||||
$this->deleteBucket($document, $project->getId());
|
$this->deleteBucket($document, $project->getId());
|
||||||
|
|
@ -263,6 +266,24 @@ class DeletesV1 extends Worker
|
||||||
], $this->getProjectDB($projectId));
|
], $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
|
* @param Document $document project document
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue