1
0
Fork 0
mirror of synced 2024-07-05 14:40:42 +12:00
This commit is contained in:
shimon 2023-03-09 14:14:40 +02:00
parent 70e4bd844e
commit 294e0e7469

View file

@ -42,10 +42,12 @@ Server::setResource('execute', function () {
$user ??= new Document();
$functionId = $function->getId();
$functionInternalId = $function->getInternalId();
$deploymentId = $function->getAttribute('deployment', '');
/** Check if deployment exists */
$deployment = $dbForProject->getDocument('deployments', $deploymentId);
$deploymentInternalId = $deployment->getInternalId();
if ($deployment->getAttribute('resourceId') !== $functionId) {
throw new Exception('Deployment not found. Create deployment before trying to execute a function');
@ -82,6 +84,8 @@ Server::setResource('execute', function () {
'$id' => $executionId,
'$permissions' => $user->isEmpty() ? [] : [Permission::read(Role::user($user->getId()))],
'functionId' => $functionId,
'functionInternalId' => $functionInternalId,
'deploymentInternalId' => $deploymentInternalId,
'deploymentId' => $deploymentId,
'trigger' => $trigger,
'status' => 'waiting',