issue link_issues
This commit is contained in:
parent
b0ecc0a30b
commit
0fda6721de
|
@ -1,7 +1,7 @@
|
|||
class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||
before_action :require_login, except: [:index]
|
||||
before_action :load_project
|
||||
before_action :load_issue, only: %i[show update destroy link_index]
|
||||
before_action :load_issue, only: %i[show update destroy link_index link_issues]
|
||||
before_action :load_issues, only: %i[batch_update batch_destroy]
|
||||
before_action :check_issue_operate_permission, only: %i[update destroy]
|
||||
|
||||
|
@ -32,6 +32,19 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
|||
render 'api/v1/issues/index'
|
||||
end
|
||||
|
||||
def link_issues
|
||||
pm_issue_type = params[:pm_issue_type] || [1, 2, 3]
|
||||
not_join_id = Issue.where(root_id: @issue.id).pluck(:id)
|
||||
not_join_id << @issue.id
|
||||
object_issues = Issue.where(
|
||||
pm_project_id: params[:pm_project_id],
|
||||
root_id: nil,
|
||||
pm_issue_type: pm_issue_type
|
||||
).where.not(id: not_join_id)
|
||||
@issues = kaminari_paginate(object_issues)
|
||||
render 'api/v1/issues/index'
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@issue.associate_attachment_container
|
||||
|
|
|
@ -11,6 +11,7 @@ defaults format: :json do
|
|||
end
|
||||
member do
|
||||
get :link_index
|
||||
get :link_issues
|
||||
end
|
||||
|
||||
resources :issue_links
|
||||
|
|
Loading…
Reference in New Issue