PR review changes
This commit is contained in:
parent
e6ccfb6dd7
commit
1e95346205
4 changed files with 22 additions and 30 deletions
|
@ -85,8 +85,7 @@ App::post('/v1/functions')
|
|||
'schedulePrevious' => null,
|
||||
'scheduleNext' => null,
|
||||
'timeout' => $timeout,
|
||||
'search' => implode(' ', [$functionId, $name, $runtime]),
|
||||
'vars' => null
|
||||
'search' => implode(' ', [$functionId, $name, $runtime])
|
||||
]));
|
||||
|
||||
$eventsInstance->setParam('functionId', $function->getId());
|
||||
|
@ -1048,13 +1047,10 @@ App::post('/v1/functions/:functionId/executions')
|
|||
return $response->dynamic($execution, Response::MODEL_EXECUTION);
|
||||
}
|
||||
|
||||
$vars = [];
|
||||
|
||||
$variables = $function['vars'];
|
||||
|
||||
foreach ($variables as $variable) {
|
||||
$vars[$variable['key']] = $variable['value'];
|
||||
}
|
||||
$vars = array_reduce($function['vars'] ?? [], function (array $carry, Document $var) {
|
||||
$carry[$var->getAttribute('key')] = $var->getAttribute('value');
|
||||
return $carry;
|
||||
}, []);
|
||||
|
||||
$vars = \array_merge($vars, [
|
||||
'APPWRITE_FUNCTION_ID' => $function->getId(),
|
||||
|
@ -1380,8 +1376,8 @@ App::get('/v1/functions/:functionId/variables')
|
|||
}
|
||||
|
||||
// Get cursor document if there was a cursor query
|
||||
$cursor = Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE)[0] ?? null;
|
||||
if ($cursor !== null) {
|
||||
$cursor = reset(Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE));
|
||||
if ($cursor) {
|
||||
/** @var Query $cursor */
|
||||
$variableId = $cursor->getValue();
|
||||
$cursorDocument = $dbForProject->getDocument('variables', $variableId);
|
||||
|
@ -1424,7 +1420,7 @@ App::get('/v1/functions/:functionId/variables/:variableId')
|
|||
}
|
||||
|
||||
$variable = $dbForProject->findOne('variables', [
|
||||
Query::equal('_uid', [$variableId]),
|
||||
Query::equal('$id', [$variableId]),
|
||||
Query::equal('functionInternalId', [$function->getInternalId()]),
|
||||
]);
|
||||
|
||||
|
@ -1464,7 +1460,7 @@ App::put('/v1/functions/:functionId/variables/:variableId')
|
|||
}
|
||||
|
||||
$variable = $dbForProject->findOne('variables', [
|
||||
Query::equal('_uid', [$variableId]),
|
||||
Query::equal('$id', [$variableId]),
|
||||
Query::equal('functionInternalId', [$function->getInternalId()]),
|
||||
]);
|
||||
|
||||
|
@ -1511,7 +1507,7 @@ App::delete('/v1/functions/:functionId/variables/:variableId')
|
|||
}
|
||||
|
||||
$variable = $dbForProject->findOne('variables', [
|
||||
Query::equal('_uid', [$variableId]),
|
||||
Query::equal('$id', [$variableId]),
|
||||
Query::equal('functionInternalId', [$function->getInternalId()]),
|
||||
]);
|
||||
|
||||
|
|
|
@ -145,12 +145,11 @@ class BuildsV1 extends Worker
|
|||
);
|
||||
|
||||
$source = $deployment->getAttribute('path');
|
||||
$vars = [];
|
||||
$variables = $function['vars'];
|
||||
|
||||
foreach ($variables as $variable) {
|
||||
$vars[$variable['key']] = $variable['value'];
|
||||
}
|
||||
$vars = array_reduce($function['vars'] ?? [], function (array $carry, Document $var) {
|
||||
$carry[$var->getAttribute('key')] = $var->getAttribute('value');
|
||||
return $carry;
|
||||
}, []);
|
||||
|
||||
$baseImage = $runtime['image'];
|
||||
|
||||
|
|
|
@ -259,13 +259,10 @@ class FunctionsV1 extends Worker
|
|||
$execution->setAttribute('status', 'processing');
|
||||
$execution = $dbForProject->updateDocument('executions', $executionId, $execution);
|
||||
|
||||
$vars = [];
|
||||
|
||||
$variables = $function['vars'];
|
||||
|
||||
foreach ($variables as $variable) {
|
||||
$vars[$variable['key']] = $variable['value'];
|
||||
}
|
||||
$vars = array_reduce($function['vars'] ?? [], function (array $carry, Document $var) {
|
||||
$carry[$var->getAttribute('key')] = $var->getAttribute('value');
|
||||
return $carry;
|
||||
}, []);
|
||||
|
||||
/** Collect environment variables */
|
||||
$vars = \array_merge($vars, [
|
||||
|
|
8
composer.lock
generated
8
composer.lock
generated
|
@ -2841,12 +2841,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||
"reference": "bf05fc00755b9d27dac530669ca834f3ceb655ec"
|
||||
"reference": "6e630a62f522ac68a7056bebf81cd032c7a053ba"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/bf05fc00755b9d27dac530669ca834f3ceb655ec",
|
||||
"reference": "bf05fc00755b9d27dac530669ca834f3ceb655ec",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/6e630a62f522ac68a7056bebf81cd032c7a053ba",
|
||||
"reference": "6e630a62f522ac68a7056bebf81cd032c7a053ba",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2884,7 +2884,7 @@
|
|||
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/master"
|
||||
},
|
||||
"time": "2022-08-28T04:14:32+00:00"
|
||||
"time": "2022-08-29T10:43:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
|
|
Loading…
Reference in a new issue