Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-28 06:06:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-28 06:06:32 +0300
commit284ae7dd7536df63fc6dd971f65ca420e26d2f05 (patch)
tree356c0c422685367487d15a8634e978d1f5e8f4ca /lib/api
parent2c0b1b6259d83e37c2a2b456a1f9afdb8817a3d5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/deployments.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/api/deployments.rb b/lib/api/deployments.rb
index f97200f20b9..84d1d8a0aac 100644
--- a/lib/api/deployments.rb
+++ b/lib/api/deployments.rb
@@ -17,16 +17,19 @@ module API
end
params do
use :pagination
- optional :order_by, type: String, values: %w[id iid created_at updated_at ref], default: 'id', desc: 'Return deployments ordered by `id` or `iid` or `created_at` or `updated_at` or `ref`'
- optional :sort, type: String, values: %w[asc desc], default: 'asc', desc: 'Sort by asc (ascending) or desc (descending)'
+ optional :order_by, type: String, values: DeploymentsFinder::ALLOWED_SORT_VALUES, default: DeploymentsFinder::DEFAULT_SORT_VALUE, desc: 'Return deployments ordered by specified value'
+ optional :sort, type: String, values: DeploymentsFinder::ALLOWED_SORT_DIRECTIONS, default: DeploymentsFinder::DEFAULT_SORT_DIRECTION, desc: 'Sort by asc (ascending) or desc (descending)'
+ optional :updated_after, type: DateTime, desc: 'Return deployments updated after the specified date'
+ optional :updated_before, type: DateTime, desc: 'Return deployments updated before the specified date'
end
- # rubocop: disable CodeReuse/ActiveRecord
+
get ':id/deployments' do
authorize! :read_deployment, user_project
- present paginate(user_project.deployments.order(params[:order_by] => params[:sort])), with: Entities::Deployment
+ deployments = DeploymentsFinder.new(user_project, params).execute
+
+ present paginate(deployments), with: Entities::Deployment
end
- # rubocop: enable CodeReuse/ActiveRecord
desc 'Gets a specific deployment' do
detail 'This feature was introduced in GitLab 8.11.'