projects.php

This commit is contained in:
shimon 2024-11-07 13:19:52 +02:00
parent 76701b0cca
commit f3315c69a0

View file

@ -118,10 +118,6 @@ App::post('/v1/projects')
$projectId = ($projectId == 'unique()') ? ID::unique() : $projectId;
if ($projectId === 'console') {
throw new Exception(Exception::PROJECT_RESERVED_PROJECT, "'console' is a reserved project.");
}
$databases = Config::getParam('pools-database', []);
$databaseOverride = System::getEnv('_APP_DATABASE_OVERRIDE');
@ -132,6 +128,10 @@ App::post('/v1/projects')
$dsn = $databases[array_rand($databases)];
}
if ($projectId === 'console') {
throw new Exception(Exception::PROJECT_RESERVED_PROJECT, "'console' is a reserved project.");
}
// TODO: Temporary until all projects are using shared tables.
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
@ -1070,7 +1070,7 @@ App::get('/v1/projects/:projectId/webhooks/:webhookId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($webhook === false || $webhook->isEmpty()) {
if ($webhook->isEmpty()) {
throw new Exception(Exception::WEBHOOK_NOT_FOUND);
}
@ -1113,7 +1113,7 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($webhook === false || $webhook->isEmpty()) {
if ($webhook->isEmpty()) {
throw new Exception(Exception::WEBHOOK_NOT_FOUND);
}
@ -1163,7 +1163,7 @@ App::patch('/v1/projects/:projectId/webhooks/:webhookId/signature')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($webhook === false || $webhook->isEmpty()) {
if ($webhook->isEmpty()) {
throw new Exception(Exception::WEBHOOK_NOT_FOUND);
}
@ -1201,7 +1201,7 @@ App::delete('/v1/projects/:projectId/webhooks/:webhookId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($webhook === false || $webhook->isEmpty()) {
if ($webhook->isEmpty()) {
throw new Exception(Exception::WEBHOOK_NOT_FOUND);
}
@ -1323,7 +1323,7 @@ App::get('/v1/projects/:projectId/keys/:keyId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($key === false || $key->isEmpty()) {
if ($key->isEmpty()) {
throw new Exception(Exception::KEY_NOT_FOUND);
}
@ -1360,7 +1360,7 @@ App::put('/v1/projects/:projectId/keys/:keyId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($key === false || $key->isEmpty()) {
if ($key->isEmpty()) {
throw new Exception(Exception::KEY_NOT_FOUND);
}
@ -1402,7 +1402,7 @@ App::delete('/v1/projects/:projectId/keys/:keyId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($key === false || $key->isEmpty()) {
if ($key->isEmpty()) {
throw new Exception(Exception::KEY_NOT_FOUND);
}
@ -1560,7 +1560,7 @@ App::get('/v1/projects/:projectId/platforms/:platformId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($platform === false || $platform->isEmpty()) {
if ($platform->isEmpty()) {
throw new Exception(Exception::PLATFORM_NOT_FOUND);
}
@ -1597,7 +1597,7 @@ App::put('/v1/projects/:projectId/platforms/:platformId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($platform === false || $platform->isEmpty()) {
if ($platform->isEmpty()) {
throw new Exception(Exception::PLATFORM_NOT_FOUND);
}
@ -1641,7 +1641,7 @@ App::delete('/v1/projects/:projectId/platforms/:platformId')
Query::equal('projectInternalId', [$project->getInternalId()]),
]);
if ($platform === false || $platform->isEmpty()) {
if ($platform->isEmpty()) {
throw new Exception(Exception::PLATFORM_NOT_FOUND);
}