diff --git a/app/config/collections.php b/app/config/collections.php index 7614cde4a7..3a811f6aaf 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -1993,7 +1993,7 @@ $collections = [ 'filters' => [], ], [ - '$id' => 'deploy', + '$id' => 'activate', 'type' => Database::VAR_BOOLEAN, 'format' => '', 'size' => 0, diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index b42e495fb7..0852a5f966 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -464,14 +464,14 @@ App::post('/v1/functions/:functionId/deployments') ->param('functionId', '', new UID(), 'Function ID.') ->param('entrypoint', '', new Text('1028'), 'Entrypoint File.') ->param('code', [], new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', false) - ->param('deploy', false, new Boolean(true), 'Automatically deploy the function when it is finished building.', false) + ->param('activate', false, new Boolean(true), 'Automatically activate the deployment when it is finished building.', false) ->inject('request') ->inject('response') ->inject('dbForProject') ->inject('usage') ->inject('user') ->inject('project') - ->action(function ($functionId, $entrypoint, $file, $deploy, $request, $response, $dbForProject, $usage, $user, $project) { + ->action(function ($functionId, $entrypoint, $file, $activate, $request, $response, $dbForProject, $usage, $user, $project) { /** @var Utopia\Swoole\Request $request */ /** @var Appwrite\Utopia\Response $response */ /** @var Utopia\Database\Database $dbForProject */ @@ -520,16 +520,16 @@ App::post('/v1/functions/:functionId/deployments') throw new Exception('Failed moving file', 500); } - if ((bool) $deploy) { + if ((bool) $activate) { // Remove deploy for all other deployments. $deployments = $dbForProject->find('deployments', [ - new Query('deploy', Query::TYPE_EQUAL, [true]), + new Query('activate', Query::TYPE_EQUAL, [true]), new Query('resourceId', Query::TYPE_EQUAL, [$functionId]), new Query('resourceType', Query::TYPE_EQUAL, ['functions']) ]); foreach ($deployments as $deployment) { - $deployment->setAttribute('deploy', false); + $deployment->setAttribute('activate', false); $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); } } @@ -546,7 +546,7 @@ App::post('/v1/functions/:functionId/deployments') 'path' => $path, 'size' => $size, 'search' => implode(' ', [$deploymentId, $entrypoint]), - 'deploy' => ($deploy === 'true'), + 'activate' => ((bool) $activate === true), ])); // Enqueue a message to start the build diff --git a/app/workers/builds.php b/app/workers/builds.php index 888eaa5675..41f3228d94 100644 --- a/app/workers/builds.php +++ b/app/workers/builds.php @@ -148,7 +148,7 @@ class BuildsV1 extends Worker $build = $dbForProject->updateDocument('builds', $buildId, $build); /** Set auto deploy */ - if ($deployment->getAttribute('deploy') === true) { + if ($deployment->getAttribute('activate') === true) { $function->setAttribute('deployment', $deployment->getId()); $function = $dbForProject->updateDocument('functions', $functionId, $function); } diff --git a/src/Appwrite/Utopia/Response/Model/Deployment.php b/src/Appwrite/Utopia/Response/Model/Deployment.php index 28a01ad6c0..b2d38f144a 100644 --- a/src/Appwrite/Utopia/Response/Model/Deployment.php +++ b/src/Appwrite/Utopia/Response/Model/Deployment.php @@ -52,9 +52,9 @@ class Deployment extends Model 'default' => '', 'example' => '5e5ea5c16897e', ]) - ->addRule('deploy', [ + ->addRule('activate', [ 'type' => self::TYPE_BOOLEAN, - 'description' => 'Whether the deployment should be automatically deployed.', + 'description' => 'Whether the deployment should be automatically activated.', 'default' => false, 'example' => true, ])