adding region query to deleteProjectsByTeam

This commit is contained in:
shimon
2025-03-25 19:13:11 +02:00
parent 854256e8a6
commit dedcdc2e0e
2 changed files with 5 additions and 11 deletions
-8
View File
@@ -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);
}
+5 -3
View File
@@ -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) {