mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 12:45:46 +08:00
issue links
This commit is contained in:
25
app/controllers/api/pm/issue_links_controller.rb
Normal file
25
app/controllers/api/pm/issue_links_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
Reference in New Issue
Block a user