Commit 191193ed authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Extract EE params in Issues API to separate module

parent 539963dc
module EE
module API
module Issues
extend ActiveSupport::Concern
prepended do
helpers do
params :issues_params_ee do
optional :weight, types: [Integer, String], integer_none_any: true, desc: 'The weight of the issue'
end
params :issue_params_ee do
optional :weight, type: Integer, desc: 'The weight of the issue'
end
end
end
end
end
end
......@@ -49,14 +49,14 @@ describe API::Issues, :mailer do
get api('/issues', user), weight: 5, scope: 'all'
expect_paginated_array_response(size: 1)
expect(first_issue['id']).to eq(issue2.id)
expect(json_response.first['id']).to eq(issue2.id)
end
it 'returns issues with no weight' do
get api('/issues', user), weight: 'None', scope: 'all'
expect_paginated_array_response(size: 1)
expect(first_issue['id']).to eq(issue.id)
expect(json_response.first['id']).to eq(issue.id)
end
it 'returns issues with any weight' do
......
......@@ -8,6 +8,17 @@ module API
helpers ::Gitlab::IssuableMetadata
# EE::API::Issues would override the following helpers
helpers do
params :issues_params_ee do
end
params :issue_params_ee do
end
end
prepend EE::API::Issues
helpers do
# rubocop: disable CodeReuse/ActiveRecord
def find_issues(args = {})
......@@ -25,7 +36,7 @@ module API
end
# rubocop: enable CodeReuse/ActiveRecord
params :issues_params_ce do
params :issues_params do
optional :labels, type: String, desc: 'Comma-separated list of label names'
optional :milestone, type: String, desc: 'Milestone title'
optional :order_by, type: String, values: %w[created_at updated_at], default: 'created_at',
......@@ -46,18 +57,11 @@ module API
desc: 'Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`'
optional :my_reaction_emoji, type: String, desc: 'Return issues reacted by the authenticated user by the given emoji'
use :pagination
end
params :issues_params_ee do
optional :weight, types: [Integer, String], integer_none_any: true, desc: 'The weight of the issue'
end
params :issues_params do
use :issues_params_ce
use :issues_params_ee
end
params :issue_params_ce do
params :issue_params do
optional :description, type: String, desc: 'The description of an issue'
optional :assignee_ids, type: Array[Integer], desc: 'The array of user IDs to assign issue'
optional :assignee_id, type: Integer, desc: '[Deprecated] The ID of a user to assign issue'
......@@ -66,14 +70,7 @@ module API
optional :due_date, type: String, desc: 'Date string in the format YEAR-MONTH-DAY'
optional :confidential, type: Boolean, desc: 'Boolean parameter if the issue should be confidential'
optional :discussion_locked, type: Boolean, desc: " Boolean parameter indicating if the issue's discussion is locked"
end
params :issue_params_ee do
optional :weight, type: Integer, desc: 'The weight of the issue'
end
params :issue_params do
use :issue_params_ce
use :issue_params_ee
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment