新增:root_subject参数
This commit is contained in:
parent
8325fa7367
commit
4d3e33a4e8
|
@ -172,7 +172,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
|||
params.permit(
|
||||
:status_id, :priority_id, :milestone_id,
|
||||
:branch_name, :start_date, :due_date, :time_scale,
|
||||
:subject, :description, :blockchain_token_num,
|
||||
:subject, :description, :blockchain_token_num, :root_subject,
|
||||
:pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :link_able_id, :project_id,
|
||||
issue_tag_ids: [],
|
||||
assigner_ids: [],
|
||||
|
|
|
@ -4,7 +4,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
include Api::V1::Issues::Concerns::Loadable
|
||||
|
||||
attr_reader :project, :current_user
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num
|
||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num, :root_subject
|
||||
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login
|
||||
attr_accessor :created_issue
|
||||
|
||||
|
@ -35,6 +35,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
@root_id = params[:root_id]
|
||||
@time_scale = params[:time_scale]
|
||||
@linkable_id = params[:link_able_id]
|
||||
@root_subject = params[:root_subject]
|
||||
end
|
||||
|
||||
def call
|
||||
|
@ -65,7 +66,15 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
@created_issue.pm_project_id = @pm_project_id
|
||||
@created_issue.pm_sprint_id = @pm_sprint_id
|
||||
@created_issue.pm_issue_type = @pm_issue_type
|
||||
@created_issue.root_id = @root_id
|
||||
if @root_subject.present? && @pm_issue_type.to_i == 4
|
||||
@root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id)
|
||||
unless @root_issue.present?
|
||||
@root_issue.create(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id)
|
||||
end
|
||||
@created_issue.root_id = @root_issue.id
|
||||
else
|
||||
@created_issue.root_id = @root_id
|
||||
end
|
||||
@created_issue.time_scale = @time_scale
|
||||
@created_issue.issue_tags_value = @issue_tags.order('id asc').pluck(:id).join(',') unless issue_tag_ids.blank?
|
||||
@created_issue.changer_id = @current_user.id
|
||||
|
|
Loading…
Reference in New Issue