1
0
Fork 0
mirror of synced 2024-06-29 11:40:45 +12:00

Update sub-collection names and filter names, improved error log, fixed docs typo

This commit is contained in:
Matej Baco 2021-09-01 10:43:35 +02:00
parent 51b1a7e72c
commit 0ab76a1c6f
4 changed files with 75 additions and 75 deletions

View file

@ -478,7 +478,7 @@ $collections = [
'required' => false, 'required' => false,
'default' => null, 'default' => null,
'array' => false, 'array' => false,
'filters' => ['subQueryProjectServices'], 'filters' => ['subQueryServices'],
], ],
[ [
'$id' => 'auths', '$id' => 'auths',
@ -500,7 +500,7 @@ $collections = [
'required' => false, 'required' => false,
'default' => null, 'default' => null,
'array' => false, 'array' => false,
'filters' => ['subQueryProjectProviders'], 'filters' => ['subQueryProviders'],
], ],
[ [
'$id' => 'platforms', '$id' => 'platforms',
@ -511,7 +511,7 @@ $collections = [
'required' => false, 'required' => false,
'default' => null, 'default' => null,
'array' => false, 'array' => false,
'filters' => ['subQueryProjectPlatforms'], 'filters' => ['subQueryPlatforms'],
], ],
[ [
'$id' => 'webhooks', '$id' => 'webhooks',
@ -522,7 +522,7 @@ $collections = [
'required' => false, 'required' => false,
'default' => null, 'default' => null,
'array' => false, 'array' => false,
'filters' => ['subQueryProjectWebhooks'], 'filters' => ['subQueryWebhooks'],
], ],
[ [
'$id' => 'keys', '$id' => 'keys',
@ -533,7 +533,7 @@ $collections = [
'required' => false, 'required' => false,
'default' => null, 'default' => null,
'array' => false, 'array' => false,
'filters' => ['subQueryProjectKeys'], 'filters' => ['subQueryKeys'],
], ],
[ [
'$id' => 'domains', '$id' => 'domains',
@ -544,7 +544,7 @@ $collections = [
'required' => false, 'required' => false,
'default' => null, 'default' => null,
'array' => false, 'array' => false,
'filters' => ['subQueryProjectDomains'], 'filters' => ['subQueryDomains'],
], ],
], ],
'indexes' => [ 'indexes' => [
@ -558,10 +558,10 @@ $collections = [
], ],
], ],
'projectsPlatforms' => [ 'platforms' => [
'$collection' => Database::METADATA, '$collection' => Database::METADATA,
'$id' => 'projectsPlatforms', '$id' => 'platforms',
'name' => 'projectsPlatforms', 'name' => 'platforms',
'attributes' => [ 'attributes' => [
[ [
'$id' => 'projectId', '$id' => 'projectId',
@ -663,10 +663,10 @@ $collections = [
], ],
], ],
'projectsServices' => [ 'services' => [
'$collection' => Database::METADATA, '$collection' => Database::METADATA,
'$id' => 'projectsServices', '$id' => 'services',
'name' => 'projectsServices', 'name' => 'services',
'attributes' => [ 'attributes' => [
[ [
'$id' => 'projectId', '$id' => 'projectId',
@ -713,10 +713,10 @@ $collections = [
], ],
], ],
'projectProviders' => [ 'providers' => [
'$collection' => Database::METADATA, '$collection' => Database::METADATA,
'$id' => 'projectProviders', '$id' => 'providers',
'name' => 'projectProviders', 'name' => 'providers',
'attributes' => [ 'attributes' => [
[ [
'$id' => 'projectId', '$id' => 'projectId',
@ -774,10 +774,10 @@ $collections = [
], ],
], ],
'projectDomains' => [ 'domains' => [
'$collection' => Database::METADATA, '$collection' => Database::METADATA,
'$id' => 'projectDomains', '$id' => 'domains',
'name' => 'projectDomains', 'name' => 'domains',
'attributes' => [ 'attributes' => [
[ [
'$id' => 'projectId', '$id' => 'projectId',
@ -868,10 +868,10 @@ $collections = [
], ],
], ],
'projectKeys' => [ 'keys' => [
'$collection' => Database::METADATA, '$collection' => Database::METADATA,
'$id' => 'projectKeys', '$id' => 'keys',
'name' => 'projectKeys', 'name' => 'keys',
'attributes' => [ 'attributes' => [
[ [
'$id' => 'projectId', '$id' => 'projectId',
@ -929,10 +929,10 @@ $collections = [
], ],
], ],
'projectWebhooks' => [ 'webhooks' => [
'$collection' => Database::METADATA, '$collection' => Database::METADATA,
'$id' => 'projectWebhooks', '$id' => 'webhooks',
'name' => 'projectWebhooks', 'name' => 'webhooks',
'attributes' => [ 'attributes' => [
[ [
'$id' => 'projectId', '$id' => 'projectId',

View file

@ -217,7 +217,7 @@ App::get('/v1/projects/:projectId')
}); });
App::get('/v1/projects/:projectId/usage') App::get('/v1/projects/:projectId/usage')
->desc('Get Project') ->desc('Get Project Usage')
->groups(['api', 'projects']) ->groups(['api', 'projects'])
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
@ -484,7 +484,7 @@ App::patch('/v1/projects/:projectId/service')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$document = $dbForConsole->findOne('projectsServices', [ $document = $dbForConsole->findOne('services', [
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]), new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]),
new Query('key', Query::TYPE_EQUAL, [$service]), new Query('key', Query::TYPE_EQUAL, [$service]),
]); ]);
@ -499,7 +499,7 @@ App::patch('/v1/projects/:projectId/service')
'status' => $status, 'status' => $status,
]); ]);
$dbForConsole->createDocument('projectsServices', $document); $dbForConsole->createDocument('services', $document);
$project $project
->setAttribute('services', $document, Document::SET_TYPE_APPEND); ->setAttribute('services', $document, Document::SET_TYPE_APPEND);
@ -508,7 +508,7 @@ App::patch('/v1/projects/:projectId/service')
} else { } else {
if($document->getAttribute('status') != $status) { if($document->getAttribute('status') != $status) {
$document->setAttribute('status', $status); $document->setAttribute('status', $status);
$dbForConsole->updateDocument('projectsServices', $document->getId(), $document); $dbForConsole->updateDocument('services', $document->getId(), $document);
$project->findAndReplace('$id', $document->getId(), $document, 'services'); $project->findAndReplace('$id', $document->getId(), $document, 'services');
@ -545,7 +545,7 @@ App::patch('/v1/projects/:projectId/oauth2')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$provider = $dbForConsole->findOne('projectProviders', [ $provider = $dbForConsole->findOne('providers', [
new Query('key', Query::TYPE_EQUAL, [$providerKey]), new Query('key', Query::TYPE_EQUAL, [$providerKey]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]), new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]),
]); ]);
@ -556,7 +556,7 @@ App::patch('/v1/projects/:projectId/oauth2')
$provider->setAttribute('appId', $appId) $provider->setAttribute('appId', $appId)
->setAttribute('appSecret', $secret); ->setAttribute('appSecret', $secret);
$dbForConsole->updateDocument('projectProviders', $provider->getId(), $provider); $dbForConsole->updateDocument('providers', $provider->getId(), $provider);
$project->findAndReplace('$id', $provider->getId(), $provider, 'providers'); $project->findAndReplace('$id', $provider->getId(), $provider, 'providers');
@ -574,7 +574,7 @@ App::patch('/v1/projects/:projectId/oauth2')
'appSecret' => $secret 'appSecret' => $secret
]); ]);
$dbForConsole->createDocument('projectProviders', $provider); $dbForConsole->createDocument('providers', $provider);
$project $project
->setAttribute('providers', $provider, Document::SET_TYPE_APPEND); ->setAttribute('providers', $provider, Document::SET_TYPE_APPEND);
@ -748,7 +748,7 @@ App::post('/v1/projects/:projectId/webhooks')
'httpPass' => $httpPass, 'httpPass' => $httpPass,
]); ]);
$webhook = $dbForConsole->createDocument('projectWebhooks', $webhook); $webhook = $dbForConsole->createDocument('webhooks', $webhook);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -779,7 +779,7 @@ App::get('/v1/projects/:projectId/webhooks')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$webhooks = $dbForConsole->find('projectWebhooks', [ $webhooks = $dbForConsole->find('webhooks', [
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -813,7 +813,7 @@ App::get('/v1/projects/:projectId/webhooks/:webhookId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$webhook = $dbForConsole->findOne('projectWebhooks', [ $webhook = $dbForConsole->findOne('webhooks', [
new Query('_uid', Query::TYPE_EQUAL, [$webhookId]), new Query('_uid', Query::TYPE_EQUAL, [$webhookId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -857,7 +857,7 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId')
$security = ($security === '1' || $security === 'true' || $security === 1 || $security === true); $security = ($security === '1' || $security === 'true' || $security === 1 || $security === true);
$webhook = $dbForConsole->findOne('projectWebhooks', [ $webhook = $dbForConsole->findOne('webhooks', [
new Query('_uid', Query::TYPE_EQUAL, [$webhookId]), new Query('_uid', Query::TYPE_EQUAL, [$webhookId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -874,7 +874,7 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId')
->setAttribute('httpUser', $httpUser) ->setAttribute('httpUser', $httpUser)
->setAttribute('httpPass', $httpPass); ->setAttribute('httpPass', $httpPass);
$dbForConsole->updateDocument('projectWebhooks', $webhook->getId(), $webhook); $dbForConsole->updateDocument('webhooks', $webhook->getId(), $webhook);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -904,7 +904,7 @@ App::delete('/v1/projects/:projectId/webhooks/:webhookId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$webhook = $dbForConsole->findOne('projectWebhooks', [ $webhook = $dbForConsole->findOne('webhooks', [
new Query('_uid', Query::TYPE_EQUAL, [$webhookId]), new Query('_uid', Query::TYPE_EQUAL, [$webhookId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -913,7 +913,7 @@ App::delete('/v1/projects/:projectId/webhooks/:webhookId')
throw new Exception('Webhook not found', 404); throw new Exception('Webhook not found', 404);
} }
$dbForConsole->deleteDocument('projectWebhooks', $webhook->getId()); $dbForConsole->deleteDocument('webhooks', $webhook->getId());
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -957,7 +957,7 @@ App::post('/v1/projects/:projectId/keys')
'secret' => \bin2hex(\random_bytes(128)), 'secret' => \bin2hex(\random_bytes(128)),
]); ]);
$key = $dbForConsole->createDocument('projectKeys', $key); $key = $dbForConsole->createDocument('keys', $key);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -988,7 +988,7 @@ App::get('/v1/projects/:projectId/keys')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$keys = $dbForConsole->find('projectKeys', [ $keys = $dbForConsole->find('keys', [
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]), new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]),
], 5000); ], 5000);
@ -1022,12 +1022,12 @@ App::get('/v1/projects/:projectId/keys/:keyId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$key = $dbForConsole->findOne('projectKeys', [ $key = $dbForConsole->findOne('keys', [
new Query('_uid', Query::TYPE_EQUAL, [$keyId]), new Query('_uid', Query::TYPE_EQUAL, [$keyId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
if ($key !== true || $key->isEmpty()) { if ($key == false || $key->isEmpty()) {
throw new Exception('Key not found', 404); throw new Exception('Key not found', 404);
} }
@ -1060,7 +1060,7 @@ App::put('/v1/projects/:projectId/keys/:keyId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$key = $dbForConsole->findOne('projectKeys', [ $key = $dbForConsole->findOne('keys', [
new Query('_uid', Query::TYPE_EQUAL, [$keyId]), new Query('_uid', Query::TYPE_EQUAL, [$keyId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -1072,7 +1072,7 @@ App::put('/v1/projects/:projectId/keys/:keyId')
$key->setAttribute('name', $name) $key->setAttribute('name', $name)
->setAttribute('scopes', $scopes); ->setAttribute('scopes', $scopes);
$dbForConsole->updateDocument('projectKeys', $key->getId(), $key); $dbForConsole->updateDocument('keys', $key->getId(), $key);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -1102,7 +1102,7 @@ App::delete('/v1/projects/:projectId/keys/:keyId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$key = $dbForConsole->findOne('projectKeys', [ $key = $dbForConsole->findOne('keys', [
new Query('_uid', Query::TYPE_EQUAL, [$keyId]), new Query('_uid', Query::TYPE_EQUAL, [$keyId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -1111,7 +1111,7 @@ App::delete('/v1/projects/:projectId/keys/:keyId')
throw new Exception('Key not found', 404); throw new Exception('Key not found', 404);
} }
$dbForConsole->deleteDocument('projectKeys', $key->getId()); $dbForConsole->deleteDocument('keys', $key->getId());
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -1162,7 +1162,7 @@ App::post('/v1/projects/:projectId/platforms')
'dateUpdated' => \time(), 'dateUpdated' => \time(),
]); ]);
$platform = $dbForConsole->createDocument('projectsPlatforms', $platform); $platform = $dbForConsole->createDocument('platforms', $platform);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -1193,7 +1193,7 @@ App::get('/v1/projects/:projectId/platforms')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$platforms = $dbForConsole->find('projectsPlatforms', [ $platforms = $dbForConsole->find('platforms', [
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
], 5000); ], 5000);
@ -1227,7 +1227,7 @@ App::get('/v1/projects/:projectId/platforms/:platformId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$platform = $dbForConsole->findOne('projectsPlatforms', [ $platform = $dbForConsole->findOne('platforms', [
new Query('_uid', Query::TYPE_EQUAL, [$platformId]), new Query('_uid', Query::TYPE_EQUAL, [$platformId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -1267,7 +1267,7 @@ App::put('/v1/projects/:projectId/platforms/:platformId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$platform = $dbForConsole->findOne('projectsPlatforms', [ $platform = $dbForConsole->findOne('platforms', [
new Query('_uid', Query::TYPE_EQUAL, [$platformId]), new Query('_uid', Query::TYPE_EQUAL, [$platformId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -1284,7 +1284,7 @@ App::put('/v1/projects/:projectId/platforms/:platformId')
->setAttribute('hostname', $hostname) ->setAttribute('hostname', $hostname)
; ;
$dbForConsole->updateDocument('projectsPlatforms', $platform->getId(), $platform); $dbForConsole->updateDocument('platforms', $platform->getId(), $platform);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -1314,7 +1314,7 @@ App::delete('/v1/projects/:projectId/platforms/:platformId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$platform = $dbForConsole->findOne('projectsPlatforms', [ $platform = $dbForConsole->findOne('platforms', [
new Query('_uid', Query::TYPE_EQUAL, [$platformId]), new Query('_uid', Query::TYPE_EQUAL, [$platformId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -1323,7 +1323,7 @@ App::delete('/v1/projects/:projectId/platforms/:platformId')
throw new Exception('Platform not found', 404); throw new Exception('Platform not found', 404);
} }
$dbForConsole->deleteDocument('projectsPlatforms', $platformId); $dbForConsole->deleteDocument('platforms', $platformId);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -1356,7 +1356,7 @@ App::post('/v1/projects/:projectId/domains')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$document = $dbForConsole->findOne('projectDomains', [ $document = $dbForConsole->findOne('domains', [
new Query('domain', Query::TYPE_EQUAL, [$domain]), new Query('domain', Query::TYPE_EQUAL, [$domain]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]), new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]),
]); ]);
@ -1386,7 +1386,7 @@ App::post('/v1/projects/:projectId/domains')
'certificateId' => null, 'certificateId' => null,
]); ]);
$domain = $dbForConsole->createDocument('projectDomains', $domain); $domain = $dbForConsole->createDocument('domains', $domain);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
@ -1417,7 +1417,7 @@ App::get('/v1/projects/:projectId/domains')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$domains = $dbForConsole->find('projectDomains', [ $domains = $dbForConsole->find('domains', [
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
], 5000); ], 5000);
@ -1451,7 +1451,7 @@ App::get('/v1/projects/:projectId/domains/:domainId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$domain = $dbForConsole->findOne('projectDomains', [ $domain = $dbForConsole->findOne('domains', [
new Query('_uid', Query::TYPE_EQUAL, [$domainId]), new Query('_uid', Query::TYPE_EQUAL, [$domainId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -1487,7 +1487,7 @@ App::patch('/v1/projects/:projectId/domains/:domainId/verification')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$domain = $dbForConsole->findOne('projectDomains', [ $domain = $dbForConsole->findOne('domains', [
new Query('_uid', Query::TYPE_EQUAL, [$domainId]), new Query('_uid', Query::TYPE_EQUAL, [$domainId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -1514,7 +1514,7 @@ App::patch('/v1/projects/:projectId/domains/:domainId/verification')
$domain->setAttribute('verification', true); $domain->setAttribute('verification', true);
$dbForConsole->updateDocument('projectDomains', $domain->getId(), $domain); $dbForConsole->updateDocument('domains', $domain->getId(), $domain);
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());
// Issue a TLS certificate when domain is verified // Issue a TLS certificate when domain is verified
@ -1550,7 +1550,7 @@ App::delete('/v1/projects/:projectId/domains/:domainId')
throw new Exception('Project not found', 404); throw new Exception('Project not found', 404);
} }
$domain = $dbForConsole->findOne('projectDomains', [ $domain = $dbForConsole->findOne('domains', [
new Query('_uid', Query::TYPE_EQUAL, [$domainId]), new Query('_uid', Query::TYPE_EQUAL, [$domainId]),
new Query('projectId', Query::TYPE_EQUAL, [$project->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$project->getId()])
]); ]);
@ -1559,7 +1559,7 @@ App::delete('/v1/projects/:projectId/domains/:domainId')
throw new Exception('Domain not found', 404); throw new Exception('Domain not found', 404);
} }
$dbForConsole->deleteDocument('projectDomains', $domain->getId()); $dbForConsole->deleteDocument('domains', $domain->getId());
$dbForConsole->purgeDocument('projects', $project->getId()); $dbForConsole->purgeDocument('projects', $project->getId());

View file

@ -203,61 +203,61 @@ Database::addFilter('subQueryIndexes',
} }
); );
Database::addFilter('subQueryProjectPlatforms', Database::addFilter('subQueryPlatforms',
function($value) { function($value) {
return null; return null;
}, },
function($value, Document $document, Database $database) { function($value, Document $document, Database $database) {
return $database return $database
->find('projectsPlatforms', [ ->find('platforms', [
new Query('projectId', Query::TYPE_EQUAL, [$document->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$document->getId()])
], 5000, 0, []); ], 5000, 0, []);
} }
); );
Database::addFilter('subQueryProjectDomains', Database::addFilter('subQueryDomains',
function($value) { function($value) {
return null; return null;
}, },
function($value, Document $document, Database $database) { function($value, Document $document, Database $database) {
return $database return $database
->find('projectDomains', [ ->find('domains', [
new Query('projectId', Query::TYPE_EQUAL, [$document->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$document->getId()])
], 5000, 0, []); ], 5000, 0, []);
} }
); );
Database::addFilter('subQueryProjectKeys', Database::addFilter('subQueryKeys',
function($value) { function($value) {
return null; return null;
}, },
function($value, Document $document, Database $database) { function($value, Document $document, Database $database) {
return $database return $database
->find('projectKeys', [ ->find('keys', [
new Query('projectId', Query::TYPE_EQUAL, [$document->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$document->getId()])
], 5000, 0, []); ], 5000, 0, []);
} }
); );
Database::addFilter('subQueryProjectWebhooks', Database::addFilter('subQueryWebhooks',
function($value) { function($value) {
return null; return null;
}, },
function($value, Document $document, Database $database) { function($value, Document $document, Database $database) {
return $database return $database
->find('projectWebhooks', [ ->find('webhooks', [
new Query('projectId', Query::TYPE_EQUAL, [$document->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$document->getId()])
], 5000, 0, []); ], 5000, 0, []);
} }
); );
Database::addFilter('subQueryProjectServices', Database::addFilter('subQueryServices',
function($value) { function($value) {
return null; return null;
}, },
function($value, Document $document, Database $database) { function($value, Document $document, Database $database) {
$services = $database $services = $database
->find('projectsServices', [ ->find('services', [
new Query('projectId', Query::TYPE_EQUAL, [$document->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$document->getId()])
], 5000, 0, []); ], 5000, 0, []);
@ -270,13 +270,13 @@ Database::addFilter('subQueryProjectServices',
} }
); );
Database::addFilter('subQueryProjectProviders', Database::addFilter('subQueryProviders',
function($value) { function($value) {
return null; return null;
}, },
function($value, Document $document, Database $database) { function($value, Document $document, Database $database) {
$providers = $database $providers = $database
->find('projectProviders', [ ->find('providers', [
new Query('projectId', Query::TYPE_EQUAL, [$document->getId()]) new Query('projectId', Query::TYPE_EQUAL, [$document->getId()])
], 5000, 0, []); ], 5000, 0, []);

View file

@ -577,7 +577,7 @@ class Database
{ {
if (!isset(self::$filters[$name])) { if (!isset(self::$filters[$name])) {
return $value; return $value;
throw new Exception('Filter not found'); throw new Exception("Filter '{$name}' not found");
} }
try { try {
@ -599,7 +599,7 @@ class Database
{ {
if (!isset(self::$filters[$name])) { if (!isset(self::$filters[$name])) {
return $value; return $value;
throw new Exception('Filter not found'); throw new Exception("Filter '{$name}' not found");
} }
try { try {