add internalId to collections
This commit is contained in:
parent
708994d4a6
commit
f3dcd6a79f
4 changed files with 75 additions and 2 deletions
|
@ -785,6 +785,17 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('resourceInternalId'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('resourceId'),
|
'$id' => ID::custom('resourceId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
@ -2370,6 +2381,17 @@ $collections = [
|
||||||
'$id' => ID::custom('deployments'),
|
'$id' => ID::custom('deployments'),
|
||||||
'name' => 'Deployments',
|
'name' => 'Deployments',
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('resourceInternalId'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('resourceId'),
|
'$id' => ID::custom('resourceId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
@ -2392,6 +2414,17 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('buildInternalId'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('buildId'),
|
'$id' => ID::custom('buildId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
@ -2572,6 +2605,17 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => 'deploymentInternalId',
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('deploymentId'),
|
'$id' => ID::custom('deploymentId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
@ -2688,6 +2732,17 @@ $collections = [
|
||||||
'$id' => ID::custom('executions'),
|
'$id' => ID::custom('executions'),
|
||||||
'name' => 'Executions',
|
'name' => 'Executions',
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('functionInternalId'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('functionId'),
|
'$id' => ID::custom('functionId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
@ -2699,6 +2754,17 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('deploymentInternalId'),
|
||||||
|
'type' => Database::VAR_STRING,
|
||||||
|
'format' => '',
|
||||||
|
'size' => Database::LENGTH_KEY,
|
||||||
|
'signed' => true,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => [],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('deploymentId'),
|
'$id' => ID::custom('deploymentId'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
|
|
@ -740,6 +740,7 @@ App::post('/v1/functions/:functionId/deployments')
|
||||||
Permission::update(Role::any()),
|
Permission::update(Role::any()),
|
||||||
Permission::delete(Role::any()),
|
Permission::delete(Role::any()),
|
||||||
],
|
],
|
||||||
|
'resourceInternalId' => $function->getInternalId(),
|
||||||
'resourceId' => $function->getId(),
|
'resourceId' => $function->getId(),
|
||||||
'resourceType' => 'functions',
|
'resourceType' => 'functions',
|
||||||
'entrypoint' => $entrypoint,
|
'entrypoint' => $entrypoint,
|
||||||
|
@ -770,6 +771,7 @@ App::post('/v1/functions/:functionId/deployments')
|
||||||
Permission::update(Role::any()),
|
Permission::update(Role::any()),
|
||||||
Permission::delete(Role::any()),
|
Permission::delete(Role::any()),
|
||||||
],
|
],
|
||||||
|
'resourceInternalId' => $function->getInternalId(),
|
||||||
'resourceId' => $function->getId(),
|
'resourceId' => $function->getId(),
|
||||||
'resourceType' => 'functions',
|
'resourceType' => 'functions',
|
||||||
'entrypoint' => $entrypoint,
|
'entrypoint' => $entrypoint,
|
||||||
|
@ -1116,7 +1118,9 @@ App::post('/v1/functions/:functionId/executions')
|
||||||
$execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', new Document([
|
$execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', new Document([
|
||||||
'$id' => $executionId,
|
'$id' => $executionId,
|
||||||
'$permissions' => !$user->isEmpty() ? [Permission::read(Role::user($user->getId()))] : [],
|
'$permissions' => !$user->isEmpty() ? [Permission::read(Role::user($user->getId()))] : [],
|
||||||
|
'functionInternalId' => $function->getInternalId(),
|
||||||
'functionId' => $function->getId(),
|
'functionId' => $function->getId(),
|
||||||
|
'deploymentInternalId' => $deployment->getInternalId(),
|
||||||
'deploymentId' => $deployment->getId(),
|
'deploymentId' => $deployment->getId(),
|
||||||
'trigger' => 'http', // http / schedule / event
|
'trigger' => 'http', // http / schedule / event
|
||||||
'status' => $async ? 'waiting' : 'processing', // waiting / processing / completed / failed
|
'status' => $async ? 'waiting' : 'processing', // waiting / processing / completed / failed
|
||||||
|
|
|
@ -97,6 +97,7 @@ class BuildsV1 extends Worker
|
||||||
'$id' => $buildId,
|
'$id' => $buildId,
|
||||||
'$permissions' => [],
|
'$permissions' => [],
|
||||||
'startTime' => $startTime,
|
'startTime' => $startTime,
|
||||||
|
'deploymentInternalId' => $deployment->getInternalId(),
|
||||||
'deploymentId' => $deployment->getId(),
|
'deploymentId' => $deployment->getId(),
|
||||||
'status' => 'processing',
|
'status' => 'processing',
|
||||||
'path' => '',
|
'path' => '',
|
||||||
|
@ -108,7 +109,8 @@ class BuildsV1 extends Worker
|
||||||
'stderr' => '',
|
'stderr' => '',
|
||||||
'duration' => 0
|
'duration' => 0
|
||||||
]));
|
]));
|
||||||
$deployment->setAttribute('buildId', $buildId);
|
$deployment->setAttribute('buildId', $build->getId());
|
||||||
|
$deployment->setAttribute('buildInternalId', $build->getInternalId());
|
||||||
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
|
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
|
||||||
} else {
|
} else {
|
||||||
$build = $dbForProject->getDocument('builds', $buildId);
|
$build = $dbForProject->getDocument('builds', $buildId);
|
||||||
|
|
|
@ -209,7 +209,8 @@ Server::setResource('execute', function () {
|
||||||
$usage
|
$usage
|
||||||
->setParam('projectId', $project->getId())
|
->setParam('projectId', $project->getId())
|
||||||
->setParam('projectInternalId', $project->getInternalId())
|
->setParam('projectInternalId', $project->getInternalId())
|
||||||
->setParam('functionId', $function->getId()) // TODO: We should use functionInternalId in usage stats
|
->setParam('functionId', $function->getId())
|
||||||
|
->setParam('functionInternalId', $function->getInternalId())
|
||||||
->setParam('executions.{scope}.compute', 1)
|
->setParam('executions.{scope}.compute', 1)
|
||||||
->setParam('executionStatus', $execution->getAttribute('status', ''))
|
->setParam('executionStatus', $execution->getAttribute('status', ''))
|
||||||
->setParam('executionTime', $execution->getAttribute('duration'))
|
->setParam('executionTime', $execution->getAttribute('duration'))
|
||||||
|
|
Loading…
Reference in a new issue