1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

Handle deleting team memberships with new db

This commit is contained in:
kodumbeats 2021-07-13 12:08:52 -04:00
parent adb26c5356
commit 4062715613

View file

@ -56,7 +56,7 @@ class DeletesV1 extends Worker
$this->deleteUser2($document, $projectId);
break;
case Database::SYSTEM_COLLECTION_TEAMS:
$this->deleteMemberships($document, $projectId);
$this->deleteMemberships2($document, $projectId);
break;
default:
Console::error('No lazy delete operation available for document of type: '.$document->getCollection());
@ -99,6 +99,16 @@ class DeletesV1 extends Worker
], $this->getProjectDB($projectId));
}
// TODO@kodumbeats typehint Utopia\Database\Document $document
protected function deleteMemberships2($document, $projectId) {
$teamId = $document->getAttribute('teamId', '');
// Delete Memberships
$this->deleteByGroup2('memberships', [
new Query('teamId', Query::TYPE_EQUAL, [$teamId])
], $this->getInternalDB($projectId));
}
protected function deleteProject(Document $document)
{
// Delete all DBs