Browse Source

issue link_issues

pull/347/head
呱呱呱 2 years ago
parent
commit
0fda6721de
2 changed files with 15 additions and 1 deletions
  1. +14
    -1
      app/controllers/api/pm/issues_controller.rb
  2. +1
    -0
      config/routes/api.rb

+ 14
- 1
app/controllers/api/pm/issues_controller.rb 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


+ 1
- 0
config/routes/api.rb View File

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

resources :issue_links


Loading…
Cancel
Save