Implement Suggestions
This commit is contained in:
parent
6c55c73352
commit
e866a352a7
|
@ -305,6 +305,7 @@ App::put('/v1/functions/:functionId')
|
||||||
/** @var Appwrite\Utopia\Response $response */
|
/** @var Appwrite\Utopia\Response $response */
|
||||||
/** @var Utopia\Database\Database $dbForProject */
|
/** @var Utopia\Database\Database $dbForProject */
|
||||||
/** @var Utopia\Database\Document $project */
|
/** @var Utopia\Database\Document $project */
|
||||||
|
/** @var Appwrite\Auth\User $user */
|
||||||
|
|
||||||
$function = $dbForProject->getDocument('functions', $functionId);
|
$function = $dbForProject->getDocument('functions', $functionId);
|
||||||
|
|
||||||
|
@ -426,6 +427,7 @@ App::delete('/v1/functions/:functionId')
|
||||||
/** @var Appwrite\Utopia\Response $response */
|
/** @var Appwrite\Utopia\Response $response */
|
||||||
/** @var Utopia\Database\Database $dbForProject */
|
/** @var Utopia\Database\Database $dbForProject */
|
||||||
/** @var Appwrite\Event\Event $deletes */
|
/** @var Appwrite\Event\Event $deletes */
|
||||||
|
/** @var Utopia\Database\Document $project */
|
||||||
|
|
||||||
$function = $dbForProject->getDocument('functions', $functionId);
|
$function = $dbForProject->getDocument('functions', $functionId);
|
||||||
|
|
||||||
|
@ -550,7 +552,7 @@ App::post('/v1/functions/:functionId/tags')
|
||||||
throw new Exception('Failed moving file', 500);
|
throw new Exception('Failed moving file', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($automaticDeploy === 'true') {
|
if ((bool) $automaticDeploy) {
|
||||||
// Remove automaticDeploy for all other tags.
|
// Remove automaticDeploy for all other tags.
|
||||||
$tags = $dbForProject->find('tags', [
|
$tags = $dbForProject->find('tags', [
|
||||||
new Query('automaticDeploy', Query::TYPE_EQUAL, [true]),
|
new Query('automaticDeploy', Query::TYPE_EQUAL, [true]),
|
||||||
|
@ -786,7 +788,7 @@ App::delete('/v1/functions/:functionId/tags/:tagId')
|
||||||
$error = \curl_error($ch);
|
$error = \curl_error($ch);
|
||||||
|
|
||||||
if (!empty($error)) {
|
if (!empty($error)) {
|
||||||
throw new Exception('Curl error: ' . $error, 500);
|
throw new Exception('Executor Cleanup error: ' . $error, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check status code
|
// Check status code
|
||||||
|
|
|
@ -90,6 +90,7 @@ $executionEnd = \microtime(true);
|
||||||
Console::info(count($activeFunctions) . ' functions listed in ' . ($executionEnd - $executionStart) . ' seconds');
|
Console::info(count($activeFunctions) . ' functions listed in ' . ($executionEnd - $executionStart) . ' seconds');
|
||||||
|
|
||||||
App::post('/v1/execute') // Define Route
|
App::post('/v1/execute') // Define Route
|
||||||
|
->desc('Execute a function')
|
||||||
->inject('request')
|
->inject('request')
|
||||||
->param('trigger', '', new Text(1024))
|
->param('trigger', '', new Text(1024))
|
||||||
->param('projectId', '', new Text(1024))
|
->param('projectId', '', new Text(1024))
|
||||||
|
@ -351,11 +352,10 @@ App::post('/v1/tag')
|
||||||
$response->dynamic($function, Response::MODEL_FUNCTION);
|
$response->dynamic($function, Response::MODEL_FUNCTION);
|
||||||
});
|
});
|
||||||
|
|
||||||
App::get('/v1/healthz')
|
App::get('/v1/')
|
||||||
->inject('request')
|
->inject('request')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->action(
|
->action(function ($request, $response) {
|
||||||
function ($request, $response) {
|
|
||||||
$response
|
$response
|
||||||
->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
|
->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
|
||||||
->addHeader('Expires', '0')
|
->addHeader('Expires', '0')
|
||||||
|
|
Loading…
Reference in a new issue