1
0
Fork 0
mirror of synced 2024-06-18 18:54:55 +12:00

Implement Suggestions

This commit is contained in:
Bradley Schofield 2022-01-10 14:13:23 +00:00
parent 6c55c73352
commit e866a352a7
2 changed files with 7 additions and 5 deletions

View file

@ -305,6 +305,7 @@ App::put('/v1/functions/:functionId')
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForProject */
/** @var Utopia\Database\Document $project */
/** @var Appwrite\Auth\User $user */
$function = $dbForProject->getDocument('functions', $functionId);
@ -426,6 +427,7 @@ App::delete('/v1/functions/:functionId')
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForProject */
/** @var Appwrite\Event\Event $deletes */
/** @var Utopia\Database\Document $project */
$function = $dbForProject->getDocument('functions', $functionId);
@ -550,7 +552,7 @@ App::post('/v1/functions/:functionId/tags')
throw new Exception('Failed moving file', 500);
}
if ($automaticDeploy === 'true') {
if ((bool) $automaticDeploy) {
// Remove automaticDeploy for all other tags.
$tags = $dbForProject->find('tags', [
new Query('automaticDeploy', Query::TYPE_EQUAL, [true]),
@ -786,7 +788,7 @@ App::delete('/v1/functions/:functionId/tags/:tagId')
$error = \curl_error($ch);
if (!empty($error)) {
throw new Exception('Curl error: ' . $error, 500);
throw new Exception('Executor Cleanup error: ' . $error, 500);
}
// Check status code

View file

@ -90,6 +90,7 @@ $executionEnd = \microtime(true);
Console::info(count($activeFunctions) . ' functions listed in ' . ($executionEnd - $executionStart) . ' seconds');
App::post('/v1/execute') // Define Route
->desc('Execute a function')
->inject('request')
->param('trigger', '', new Text(1024))
->param('projectId', '', new Text(1024))
@ -351,11 +352,10 @@ App::post('/v1/tag')
$response->dynamic($function, Response::MODEL_FUNCTION);
});
App::get('/v1/healthz')
App::get('/v1/')
->inject('request')
->inject('response')
->action(
function ($request, $response) {
->action(function ($request, $response) {
$response
->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
->addHeader('Expires', '0')