Improve VCS indexes
This commit is contained in:
parent
3a8f4e5039
commit
f4da8079e2
4 changed files with 200 additions and 68 deletions
|
@ -850,17 +850,6 @@ $collections = [
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
|
||||||
[
|
|
||||||
'$id' => ID::custom('search'),
|
|
||||||
'type' => Database::VAR_STRING,
|
|
||||||
'format' => '',
|
|
||||||
'size' => 16384,
|
|
||||||
'signed' => true,
|
|
||||||
'required' => false,
|
|
||||||
'default' => null,
|
|
||||||
'array' => false,
|
|
||||||
'filters' => [],
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'indexes' => [
|
'indexes' => [
|
||||||
|
@ -870,7 +859,42 @@ $collections = [
|
||||||
'attributes' => ['domain'],
|
'attributes' => ['domain'],
|
||||||
'lengths' => [Database::LENGTH_KEY],
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
'orders' => [Database::ORDER_ASC],
|
'orders' => [Database::ORDER_ASC],
|
||||||
]
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_projectInternalId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_projectId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => '_key_resourceInternalId',
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['resourceInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => '_key_resourceId',
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['resourceId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => '_key_resourceType',
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['resourceType'],
|
||||||
|
'lengths' => [100],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -2291,7 +2315,30 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'indexes' => [],
|
'indexes' => [
|
||||||
|
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_projectInternalId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_projectId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_installationId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['installationId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'vcsRepos' => [
|
'vcsRepos' => [
|
||||||
|
@ -2347,7 +2394,7 @@ $collections = [
|
||||||
'$id' => ID::custom('repositoryId'),
|
'$id' => ID::custom('repositoryId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
'format' => '',
|
'format' => '',
|
||||||
'size' => 128,
|
'size' => Database::LENGTH_KEY,
|
||||||
'signed' => true,
|
'signed' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
|
@ -2365,11 +2412,12 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
|
// TODO: Resource Internal ID?
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('resourceType'),
|
'$id' => ID::custom('resourceType'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
'format' => '',
|
'format' => '',
|
||||||
'size' => 128,
|
'size' => Database::LENGTH_KEY,
|
||||||
'signed' => true,
|
'signed' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
|
@ -2388,7 +2436,57 @@ $collections = [
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'indexes' => [],
|
'indexes' => [
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_vcsInstallationId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['vcsInstallationId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_vcsInstallationInternalId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['vcsInstallationInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_projectInternalId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_projectId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_repositoryId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['repositoryId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_resourceId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['resourceId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_resourceType'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['resourceType'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
]
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'vcsComments' => [
|
'vcsComments' => [
|
||||||
|
@ -2444,7 +2542,7 @@ $collections = [
|
||||||
'$id' => ID::custom('repositoryId'),
|
'$id' => ID::custom('repositoryId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
'format' => '',
|
'format' => '',
|
||||||
'size' => 128,
|
'size' => Database::LENGTH_KEY,
|
||||||
'signed' => true,
|
'signed' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
|
@ -2455,7 +2553,7 @@ $collections = [
|
||||||
'$id' => ID::custom('commentId'),
|
'$id' => ID::custom('commentId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
'format' => '',
|
'format' => '',
|
||||||
'size' => 128,
|
'size' => Database::LENGTH_KEY,
|
||||||
'signed' => true,
|
'signed' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
|
@ -2466,7 +2564,7 @@ $collections = [
|
||||||
'$id' => ID::custom('pullRequestId'),
|
'$id' => ID::custom('pullRequestId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
'format' => '',
|
'format' => '',
|
||||||
'size' => 128,
|
'size' => Database::LENGTH_KEY,
|
||||||
'signed' => true,
|
'signed' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
|
@ -2477,7 +2575,7 @@ $collections = [
|
||||||
'$id' => ID::custom('branch'),
|
'$id' => ID::custom('branch'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
'format' => '',
|
'format' => '',
|
||||||
'size' => 128,
|
'size' => Database::LENGTH_KEY,
|
||||||
'signed' => true,
|
'signed' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
|
@ -2485,7 +2583,57 @@ $collections = [
|
||||||
'filters' => []
|
'filters' => []
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'indexes' => [],
|
'indexes' => [
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_vcsInstallationId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['vcsInstallationId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_vcsInstallationInternalId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['vcsInstallationInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_projectInternalId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_projectId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['projectId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_repositoryId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['repositoryId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_pullRequestId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['pullRequestId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_branch'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['branch'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'functions' => [
|
'functions' => [
|
||||||
|
@ -2812,6 +2960,20 @@ $collections = [
|
||||||
'lengths' => [Database::LENGTH_KEY],
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
'orders' => [Database::ORDER_ASC],
|
'orders' => [Database::ORDER_ASC],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_vcsInstallationInternalId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['vcsInstallationInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_vcsRepositoryId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['vcsRepositoryId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('_key_vcsRepositoryDocId'),
|
'$id' => ID::custom('_key_vcsRepositoryDocId'),
|
||||||
'type' => Database::INDEX_KEY,
|
'type' => Database::INDEX_KEY,
|
||||||
|
@ -2819,6 +2981,13 @@ $collections = [
|
||||||
'lengths' => [Database::LENGTH_KEY],
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
'orders' => [Database::ORDER_ASC],
|
'orders' => [Database::ORDER_ASC],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('_key_vcsRepositoryDocInternalId'),
|
||||||
|
'type' => Database::INDEX_KEY,
|
||||||
|
'attributes' => ['vcsRepositoryDocInternalId'],
|
||||||
|
'lengths' => [Database::LENGTH_KEY],
|
||||||
|
'orders' => [Database::ORDER_ASC],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('_key_runtime'),
|
'$id' => ID::custom('_key_runtime'),
|
||||||
'type' => Database::INDEX_KEY,
|
'type' => Database::INDEX_KEY,
|
||||||
|
@ -2832,42 +3001,7 @@ $collections = [
|
||||||
'attributes' => ['deployment'],
|
'attributes' => ['deployment'],
|
||||||
'lengths' => [],
|
'lengths' => [],
|
||||||
'orders' => [Database::ORDER_ASC],
|
'orders' => [Database::ORDER_ASC],
|
||||||
],
|
]
|
||||||
[
|
|
||||||
'$id' => ID::custom('_key_schedule'),
|
|
||||||
'type' => Database::INDEX_KEY,
|
|
||||||
'attributes' => ['schedule'],
|
|
||||||
'lengths' => [],
|
|
||||||
'orders' => [Database::ORDER_ASC],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'$id' => ID::custom('_key_timeout'),
|
|
||||||
'type' => Database::INDEX_KEY,
|
|
||||||
'attributes' => ['timeout'],
|
|
||||||
'lengths' => [],
|
|
||||||
'orders' => [Database::ORDER_ASC],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'$id' => ID::custom('_key_entrypoint'),
|
|
||||||
'type' => Database::INDEX_KEY,
|
|
||||||
'attributes' => ['entrypoint'],
|
|
||||||
'lengths' => [2048],
|
|
||||||
'orders' => [Database::ORDER_ASC],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'$id' => ID::custom('_key_build_command'),
|
|
||||||
'type' => Database::INDEX_KEY,
|
|
||||||
'attributes' => ['buildCommand'],
|
|
||||||
'lengths' => [2048],
|
|
||||||
'orders' => [Database::ORDER_ASC],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'$id' => ID::custom('_key_install_command'),
|
|
||||||
'type' => Database::INDEX_KEY,
|
|
||||||
'attributes' => ['installCommand'],
|
|
||||||
'lengths' => [2048],
|
|
||||||
'orders' => [Database::ORDER_ASC],
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,6 @@ App::post('/v1/functions')
|
||||||
'resourceInternalId' => $function->getInternalId(),
|
'resourceInternalId' => $function->getInternalId(),
|
||||||
'status' => 'verified',
|
'status' => 'verified',
|
||||||
'certificateId' => '',
|
'certificateId' => '',
|
||||||
'search' => implode(' ', [$domain, $ruleId, $function->getId(), 'function']),
|
|
||||||
]))
|
]))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -684,7 +683,7 @@ App::put('/v1/functions/:functionId')
|
||||||
// Git disconnect logic
|
// Git disconnect logic
|
||||||
if ($isConnected && empty($vcsRepositoryId)) {
|
if ($isConnected && empty($vcsRepositoryId)) {
|
||||||
$repoDocs = $dbForConsole->find('vcsRepos', [
|
$repoDocs = $dbForConsole->find('vcsRepos', [
|
||||||
Query::equal('projectId', [$project->getId()]),
|
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||||
Query::equal('resourceId', [$functionId]),
|
Query::equal('resourceId', [$functionId]),
|
||||||
Query::equal('resourceType', ['function']),
|
Query::equal('resourceType', ['function']),
|
||||||
Query::limit(100),
|
Query::limit(100),
|
||||||
|
@ -1336,7 +1335,7 @@ App::post('/v1/functions/:functionId/executions')
|
||||||
->param('body', '', new Text(8192), 'HTTP body of execution. Default value is empty string.', true)
|
->param('body', '', new Text(8192), 'HTTP body of execution. Default value is empty string.', true)
|
||||||
->param('async', false, new Boolean(), 'Execute code in the background. Default value is false.', true)
|
->param('async', false, new Boolean(), 'Execute code in the background. Default value is false.', true)
|
||||||
->param('path', '/', new Text(2048), 'HTTP path of execution. Path can include query params. Default value is /', true)
|
->param('path', '/', new Text(2048), 'HTTP path of execution. Path can include query params. Default value is /', true)
|
||||||
->param('method', 'GET', new Whitelist(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], true), 'HTTP method of execution. Default value is GET.', true)
|
->param('method', 'POST', new Whitelist(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], true), 'HTTP method of execution. Default value is GET.', true)
|
||||||
->param('headers', [], new Assoc(), 'HTP headers of execution. Defaults to empty.', true)
|
->param('headers', [], new Assoc(), 'HTP headers of execution. Defaults to empty.', true)
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('project')
|
->inject('project')
|
||||||
|
|
|
@ -99,7 +99,6 @@ App::post('/v1/proxy/rules')
|
||||||
'resourceInternalId' => $resourceInternalId,
|
'resourceInternalId' => $resourceInternalId,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'certificateId' => '',
|
'certificateId' => '',
|
||||||
'search' => implode(' ', [$domain->get(), $ruleId, $resourceId, $resourceType]),
|
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$events->setParam('ruleId', $rule->getId());
|
$events->setParam('ruleId', $rule->getId());
|
||||||
|
|
|
@ -597,7 +597,7 @@ $createGitDeployments = function (GitHub $github, string $installationId, array
|
||||||
}
|
}
|
||||||
|
|
||||||
$contribution = new Document([]);
|
$contribution = new Document([]);
|
||||||
if($external) {
|
if ($external) {
|
||||||
$pullRequestResponse = $github->getPullRequest($owner, $repositoryName, $pullRequest);
|
$pullRequestResponse = $github->getPullRequest($owner, $repositoryName, $pullRequest);
|
||||||
|
|
||||||
$contribution->setAttribute('ownerName', $pullRequestResponse['head']['repo']['owner']['login']);
|
$contribution->setAttribute('ownerName', $pullRequestResponse['head']['repo']['owner']['login']);
|
||||||
|
@ -673,7 +673,7 @@ App::post('/v1/vcs/github/incomingwebhook')
|
||||||
|
|
||||||
foreach ($vcsInstallations as $installation) {
|
foreach ($vcsInstallations as $installation) {
|
||||||
$vcsRepos = $dbForConsole->find('vcsRepos', [
|
$vcsRepos = $dbForConsole->find('vcsRepos', [
|
||||||
Query::equal('vcsInstallationId', [$installation->getId()]),
|
Query::equal('vcsInstallationInternalId', [$installation->getInternalId()]),
|
||||||
Query::limit(1000)
|
Query::limit(1000)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ App::post('/v1/vcs/github/incomingwebhook')
|
||||||
$external = $parsedPayload["external"];
|
$external = $parsedPayload["external"];
|
||||||
|
|
||||||
// Ignore sync for non-external. We handle it in push webhook
|
// Ignore sync for non-external. We handle it in push webhook
|
||||||
if(!$external && $parsedPayload["action"] == "synchronize") {
|
if (!$external && $parsedPayload["action"] == "synchronize") {
|
||||||
return $response->json($parsedPayload);
|
return $response->json($parsedPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,15 +785,15 @@ App::get('/v1/vcs/installations')
|
||||||
$total = $dbForConsole->count('vcsInstallations', $filterQueries, APP_LIMIT_COUNT);
|
$total = $dbForConsole->count('vcsInstallations', $filterQueries, APP_LIMIT_COUNT);
|
||||||
|
|
||||||
if (\count($results) > 0) {
|
if (\count($results) > 0) {
|
||||||
$installationIds = \array_map(fn ($result) => $result->getId(), $results);
|
$installationIds = \array_map(fn ($result) => $result->getInternalId(), $results);
|
||||||
|
|
||||||
$functions = Authorization::skip(fn () => $dbForProject->find('functions', [
|
$functions = Authorization::skip(fn () => $dbForProject->find('functions', [
|
||||||
Query::equal('vcsInstallationId', \array_unique($installationIds)),
|
Query::equal('vcsInstallationInternalId', \array_unique($installationIds)),
|
||||||
Query::limit(APP_LIMIT_SUBQUERY)
|
Query::limit(APP_LIMIT_SUBQUERY)
|
||||||
]));
|
]));
|
||||||
|
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
$installationFunctions = \array_filter($functions, fn ($function) => $function->getAttribute('vcsInstallationId') === $result->getId());
|
$installationFunctions = \array_filter($functions, fn ($function) => $function->getAttribute('vcsInstallationInternalId') === $result->getInternalId());
|
||||||
|
|
||||||
$result->setAttribute('functions', $installationFunctions);
|
$result->setAttribute('functions', $installationFunctions);
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ App::get('/v1/vcs/installations/:installationId')
|
||||||
}
|
}
|
||||||
|
|
||||||
$functions = Authorization::skip(fn () => $dbForProject->find('functions', [
|
$functions = Authorization::skip(fn () => $dbForProject->find('functions', [
|
||||||
Query::equal('vcsInstallationId', [$installation->getId()]),
|
Query::equal('vcsInstallationInternalId', [$installation->getInternalId()]),
|
||||||
Query::limit(APP_LIMIT_SUBQUERY)
|
Query::limit(APP_LIMIT_SUBQUERY)
|
||||||
]));
|
]));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue