Browse Source

新增:批量更新迭代中工作项

pull/347/head
yystopf 2 years ago
parent
commit
fe4f56dd36
2 changed files with 29 additions and 0 deletions
  1. +28
    -0
      app/controllers/api/pm/sprint_issues_controller.rb
  2. +1
    -0
      config/routes/api.rb

+ 28
- 0
app/controllers/api/pm/sprint_issues_controller.rb View File

@@ -32,6 +32,34 @@ class Api::Pm::SprintIssuesController < Api::Pm::BaseController
end
render_ok(data: data)
end

before_action :load_uncomplete_issues, only: [:complete]

def complete
begin
case complete_params[:complete_type].to_i
when 1
@issues.update_all(status_id: 5)
when 2
@issues.update_all(pm_sprint_id: 0)
when 3
@issues.update_all(pm_sprint_id: complete_params[:target_pm_project_sprint_id])
end
render_ok
rescue => e
render_error(e.message)
end
end

private

def load_uncomplete_issues
@issues = Issue.where(pm_sprint_id: complete_params[:pm_project_sprint_id]).where.not(status_id: 5)
end

def complete_params
params.permit(:pm_project_sprint_id, :complete_type, :target_pm_project_sprint_id)
end
def query_params
params.permit(


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

@@ -24,6 +24,7 @@ defaults format: :json do
resources :sprint_issues, only: [:index] do
collection do
get :statistics
post :complete
end
end
resources :projects do


Loading…
Cancel
Save