issue link_issues

This commit is contained in:
呱呱呱 2023-11-15 11:47:17 +08:00
parent b0ecc0a30b
commit 0fda6721de
2 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -11,6 +11,7 @@ defaults format: :json do
end
member do
get :link_index
get :link_issues
end
resources :issue_links