From dedcdc2e0e71b1d8b9943c417fe32240aa6ad263 Mon Sep 17 00:00:00 2001 From: shimon Date: Tue, 25 Mar 2025 19:13:11 +0200 Subject: [PATCH] adding region query to deleteProjectsByTeam --- app/controllers/shared/api.php | 8 -------- src/Appwrite/Platform/Workers/Deletes.php | 8 +++++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index aee1ca5e09..cd9752ee24 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -192,14 +192,6 @@ App::init() $route = $utopia->getRoute(); if ($project->isEmpty()) { - - var_dump([ - 'location' => 'api.php', - 'projectId' => !empty($project->getId()) ? $project->getId() : 'NA', - 'params' => 'Method: ' . $route->getMethod(). ' URL: ' . $route->getPath(), - '_APP_REGION' => System::getEnv('_APP_REGION'), - ]); - throw new Exception(Exception::PROJECT_NOT_FOUND); } diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index 6dff127784..63020b7b9a 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -481,7 +481,7 @@ class Deletes extends Action ); } - /** + /** * @param Database $dbForPlatform * @param Document $document * @return void @@ -492,11 +492,13 @@ class Deletes extends Action * @throws Structure * @throws Exception */ - private function deleteProjectsByTeam(Database $dbForPlatform, callable $getProjectDB, CertificatesAdapter $certificates, Document $document): void + protected function deleteProjectsByTeam(Database $dbForPlatform, callable $getProjectDB, CertificatesAdapter $certificates, Document $document): void { $projects = $dbForPlatform->find('projects', [ - Query::equal('teamInternalId', [$document->getInternalId()]) + Query::equal('teamInternalId', [$document->getInternalId(), + Query::equal('region', System::getEnv('_APP_REGION', 'default')) + ]) ]); foreach ($projects as $project) {