From 94e7669b417b90aa61be0d1ab64d0e66877970ea Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Wed, 29 May 2024 17:48:52 +0530 Subject: [PATCH] Remove build id from api endpoint --- app/controllers/api/functions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 670ca2f99e..624451723e 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1433,7 +1433,8 @@ App::delete('/v1/functions/:functionId/deployments/:deploymentId') $response->noContent(); }); -App::post('/v1/functions/:functionId/deployments/:deploymentId/builds/:buildId') +App::post('/v1/functions/:functionId/deployments/:deploymentId/build') + ->alias('/v1/functions/:functionId/deployments/:deploymentId/builds/:buildId') ->groups(['api', 'functions']) ->desc('Create build') ->label('scope', 'functions.write') @@ -1448,7 +1449,7 @@ App::post('/v1/functions/:functionId/deployments/:deploymentId/builds/:buildId') ->label('sdk.response.model', Response::MODEL_NONE) ->param('functionId', '', new UID(), 'Function ID.') ->param('deploymentId', '', new UID(), 'Deployment ID.') - ->param('buildId', '', new UID(), 'Build unique ID.') + ->param('buildId', '', new UID(), 'Build unique ID.', true) ->inject('request') ->inject('response') ->inject('dbForProject') @@ -1469,6 +1470,7 @@ App::post('/v1/functions/:functionId/deployments/:deploymentId/builds/:buildId') throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); } + $buildId = $deployment->getAttribute('buildId', ''); $build = Authorization::skip(fn () => $dbForProject->getDocument('builds', $buildId)); if ($build->isEmpty()) {