Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exteand deletes worker #8274

Open
wants to merge 16 commits into
base: refactor-usage-sn
Choose a base branch
from
Prev Previous commit
Next Next commit
Delete user update
  • Loading branch information
shimonewman committed Jun 16, 2024
commit 8520a66fd9a0977e43a77a2aadf3dae46f3690e9
4 changes: 3 additions & 1 deletion src/Appwrite/Platform/Workers/Deletes.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,14 @@ protected function deleteUser(callable $getProjectDB, Document $document, Docum
$team = $dbForProject->getDocument('teams', $teamId);
if (!$team->isEmpty()) {
$total = $document->getAttribute('total');
var_dump('$total='.$total);
// Delete the team if the user is the last membership
if ($total === 1) {
var_dump('Deleting team');
$this->deleteById($team, $dbForProject);
return;
}

var_dump('decrease total');
$dbForProject->decreaseDocumentAttribute('teams', $teamId, 'total', 1, 0);
}
}
Expand Down