1
0
Fork 0
mirror of synced 2024-07-04 06:00:53 +12:00

add internalId to collections

This commit is contained in:
shimon 2022-12-25 14:07:54 +02:00
parent f96a9c3618
commit 586c7fac7c
3 changed files with 27 additions and 0 deletions

View file

@ -2234,6 +2234,17 @@ $collections = [
'array' => false,
'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('deployment'),
'type' => Database::VAR_STRING,
@ -2267,6 +2278,17 @@ $collections = [
'array' => true,
'filters' => [],
],
[
'$id' => ID::custom('scheduleInternalId'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('scheduleId'),
'type' => Database::VAR_STRING,

View file

@ -81,6 +81,7 @@ App::post('/v1/functions')
'enabled' => $enabled,
'name' => $name,
'runtime' => $runtime,
'deploymentInternalId' => '',
'deployment' => '',
'events' => $events,
'schedule' => $schedule,
@ -102,6 +103,7 @@ App::post('/v1/functions')
);
$function->setAttribute('scheduleId', $schedule->getId());
$function->setAttribute('scheduleInternalId', $schedule->getInternalId());
$dbForProject->updateDocument('functions', $function->getId(), $function);
$eventsInstance->setParam('functionId', $function->getId());
@ -534,6 +536,7 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId')
}
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
'deploymentInternalId' => $deployment->getInternalId(),
'deployment' => $deployment->getId()
])));
@ -969,6 +972,7 @@ App::delete('/v1/functions/:functionId/deployments/:deploymentId')
if ($function->getAttribute('deployment') === $deployment->getId()) { // Reset function deployment
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
'deployment' => '',
'deploymentInternalId' => '',
])));
}

View file

@ -206,6 +206,7 @@ class BuildsV1 extends Worker
/** Set auto deploy */
if ($deployment->getAttribute('activate') === true) {
$function->setAttribute('deploymentInternalId', $deployment->getInternalId());
$function->setAttribute('deployment', $deployment->getId());
$function = $dbForProject->updateDocument('functions', $function->getId(), $function);
}