26 lines
596 B
Ruby
26 lines
596 B
Ruby
class Api::Pm::IssueLinksController < Api::Pm::BaseController
|
|
before_action :load_project
|
|
before_action :load_issue
|
|
def index
|
|
@links = @issue.pm_links.where(be_linkable_type: 'Issue')
|
|
end
|
|
|
|
def create
|
|
@link = @issue.pm_links.find_or_create_by(be_linkable_type: 'Issue', be_linkable_id: params[:link_id])
|
|
data = {
|
|
data: {
|
|
id: @link.id,
|
|
issue_id: @link.linkable_id,
|
|
linked_issue_id: @link.be_linkable_id
|
|
}
|
|
}
|
|
render_ok(data)
|
|
end
|
|
|
|
def destroy
|
|
@link = @issue.pm_links.find params[:id]
|
|
@link.destroy
|
|
render_ok
|
|
end
|
|
end
|