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

Create 'alias' routes for Epics

parent e083e5cb
......@@ -55,13 +55,15 @@ module API
params do
requires :epic_iid, type: Integer, desc: 'The iid of the epic'
end
get ':id/(-/)epics/:epic_iid/issues' do
[':id/epics/:epic_iid/issues', ':id/-/epics/:epic_iid/issues'].each do |path|
get path do
authorize_can_read!
present epic.issues_readable_by(current_user),
with: EE::API::Entities::EpicIssue,
current_user: current_user
end
end
desc 'Assign an issue to the epic' do
success EE::API::Entities::EpicIssueLink
......
......@@ -39,13 +39,15 @@ module API
optional :my_reaction_emoji, type: String, desc: 'Return epics reacted by the authenticated user by the given emoji'
use :pagination
end
get ':id/(-/)epics' do
[':id/epics', ':id/-/epics'].each do |path|
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`
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)
end
end
desc 'Get details of an epic' do
success EE::API::Entities::Epic
......
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