Commit 2d79e081 authored by Ash McKenzie's avatar Ash McKenzie Committed by James Ramsay

Create 'alias' routes for Epics

parent e083e5cb
...@@ -55,12 +55,14 @@ module API ...@@ -55,12 +55,14 @@ module API
params do params do
requires :epic_iid, type: Integer, desc: 'The iid of the epic' requires :epic_iid, type: Integer, desc: 'The iid of the epic'
end end
get ':id/(-/)epics/:epic_iid/issues' do [':id/epics/:epic_iid/issues', ':id/-/epics/:epic_iid/issues'].each do |path|
authorize_can_read! get path do
authorize_can_read!
present epic.issues_readable_by(current_user), present epic.issues_readable_by(current_user),
with: EE::API::Entities::EpicIssue, with: EE::API::Entities::EpicIssue,
current_user: current_user current_user: current_user
end
end end
desc 'Assign an issue to the epic' do desc 'Assign an issue to the epic' do
......
...@@ -39,12 +39,14 @@ module API ...@@ -39,12 +39,14 @@ module API
optional :my_reaction_emoji, type: String, desc: 'Return epics reacted by the authenticated user by the given emoji' optional :my_reaction_emoji, type: String, desc: 'Return epics reacted by the authenticated user by the given emoji'
use :pagination use :pagination
end end
get ':id/(-/)epics' do [':id/epics', ':id/-/epics'].each do |path|
epics = paginate(find_epics(finder_params: { group_id: user_group.id })).with_api_entity_associations get path do
epics = paginate(find_epics(finder_params: { group_id: user_group.id })).with_api_entity_associations
# issuable_metadata has to be set because `Entities::Epic` doesn't inherit from `Entities::IssuableEntity` # issuable_metadata has to be set because `Entities::Epic` doesn't inherit from `Entities::IssuableEntity`
extra_options = { issuable_metadata: Gitlab::IssuableMetadata.new(current_user, epics).data, with_labels_details: declared_params[:with_labels_details] } extra_options = { issuable_metadata: Gitlab::IssuableMetadata.new(current_user, epics).data, with_labels_details: declared_params[:with_labels_details] }
present epics, epic_options.merge(extra_options) present epics, epic_options.merge(extra_options)
end
end end
desc 'Get details of an epic' do desc 'Get details of an epic' do
......
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