Merge pull request '工作项关联项目改查以及删除子工作项逻辑修复' (#225) from yystopf/forgeplus:pm_project_develop into pm_project_develop
This commit is contained in:
commit
c27aa16699
|
@ -155,7 +155,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||||
:status_id, :priority_id, :milestone_id,
|
:status_id, :priority_id, :milestone_id,
|
||||||
:branch_name, :start_date, :due_date, :time_scale,
|
:branch_name, :start_date, :due_date, :time_scale,
|
||||||
:subject, :description, :blockchain_token_num,
|
:subject, :description, :blockchain_token_num,
|
||||||
:pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :link_able_id,
|
:pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :link_able_id, :project_id,
|
||||||
issue_tag_ids: [],
|
issue_tag_ids: [],
|
||||||
assigner_ids: [],
|
assigner_ids: [],
|
||||||
attachment_ids: [],
|
attachment_ids: [],
|
||||||
|
@ -165,7 +165,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||||
|
|
||||||
def batch_issue_params
|
def batch_issue_params
|
||||||
params.permit(
|
params.permit(
|
||||||
:status_id, :priority_id, :milestone_id, :pm_sprint_id, :pm_issue_type, :root_id, :target_pm_project_id,
|
:status_id, :priority_id, :milestone_id, :pm_sprint_id, :pm_issue_type, :root_id, :target_pm_project_id, :project_id,
|
||||||
:issue_tag_ids => [],
|
:issue_tag_ids => [],
|
||||||
:assigner_ids => [] )
|
:assigner_ids => [] )
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Api::V1::Issues::BatchUpdateService < ApplicationService
|
||||||
include Api::V1::Issues::Concerns::Loadable
|
include Api::V1::Issues::Concerns::Loadable
|
||||||
|
|
||||||
attr_reader :project, :issues, :params, :current_user
|
attr_reader :project, :issues, :params, :current_user
|
||||||
attr_reader :status_id, :priority_id, :milestone_id
|
attr_reader :status_id, :priority_id, :milestone_id, :project_id
|
||||||
attr_reader :issue_tag_ids, :assigner_ids
|
attr_reader :issue_tag_ids, :assigner_ids
|
||||||
|
|
||||||
validates :project, :issues, :current_user, presence: true
|
validates :project, :issues, :current_user, presence: true
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Api::V1::Issues::DeleteService < ApplicationService
|
||||||
raise Error, errors.full_messages.join(", ") unless valid?
|
raise Error, errors.full_messages.join(", ") unless valid?
|
||||||
try_lock("Api::V1::Issues::DeleteService:#{project.id}") # 开始写数据,加锁
|
try_lock("Api::V1::Issues::DeleteService:#{project.id}") # 开始写数据,加锁
|
||||||
|
|
||||||
delete_be_linkable_issues
|
delete_zi_issues
|
||||||
|
|
||||||
delete_issue
|
delete_issue
|
||||||
|
|
||||||
|
@ -40,10 +40,9 @@ class Api::V1::Issues::DeleteService < ApplicationService
|
||||||
raise Error, "删除疑修失败!" unless issue.destroy!
|
raise Error, "删除疑修失败!" unless issue.destroy!
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_be_linkable_issues
|
def delete_zi_issues
|
||||||
pmlink_ids = PmLink.where(linkable: issue).pluck(:be_linkable_id)
|
zi_issues = Issue.where(pm_project_id:issue.pm_project_id, root_id: issue.id)
|
||||||
linkable_issues = Issue.where(id: pmlink_ids)
|
raise Error, "删除疑修关联项失败!" unless zi_issues.destroy_all
|
||||||
raise Error, "删除疑修关联项失败!" unless linkable_issues.destroy_all
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -5,7 +5,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
||||||
|
|
||||||
attr_reader :project, :issue, :current_user
|
attr_reader :project, :issue, :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
|
||||||
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :before_issue_tag_ids, :before_assigner_ids
|
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :before_issue_tag_ids, :before_assigner_ids, :project_id
|
||||||
attr_accessor :add_assigner_ids, :previous_issue_changes, :updated_issue, :atme_receivers
|
attr_accessor :add_assigner_ids, :previous_issue_changes, :updated_issue, :atme_receivers
|
||||||
|
|
||||||
validates :project, :issue, :current_user, presence: true
|
validates :project, :issue, :current_user, presence: true
|
||||||
|
@ -35,6 +35,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
||||||
@pm_issue_type = params[:pm_issue_type]
|
@pm_issue_type = params[:pm_issue_type]
|
||||||
@root_id = params[:root_id]
|
@root_id = params[:root_id]
|
||||||
@time_scale = params[:time_scale]
|
@time_scale = params[:time_scale]
|
||||||
|
@project_id = params[:project_id]
|
||||||
@add_assigner_ids = []
|
@add_assigner_ids = []
|
||||||
@previous_issue_changes = {}
|
@previous_issue_changes = {}
|
||||||
end
|
end
|
||||||
|
@ -80,7 +81,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
||||||
@updated_issue.root_id = @root_id unless @root_id.nil? #不为 nil的时候更新
|
@updated_issue.root_id = @root_id unless @root_id.nil? #不为 nil的时候更新
|
||||||
@updated_issue.root_id = nil if @root_id.try(:zero?) #为 0 的时候设置为 nil
|
@updated_issue.root_id = nil if @root_id.try(:zero?) #为 0 的时候设置为 nil
|
||||||
@updated_issue.time_scale = @time_scale unless @time_scale.nil?
|
@updated_issue.time_scale = @time_scale unless @time_scale.nil?
|
||||||
|
@updated_issue.project_id = @project_id unless @project_id.nil?
|
||||||
@updated_issue.updated_on = Time.now
|
@updated_issue.updated_on = Time.now
|
||||||
@updated_issue.changer_id = @current_user.id
|
@updated_issue.changer_id = @current_user.id
|
||||||
@updated_issue.save!
|
@updated_issue.save!
|
||||||
|
|
|
@ -57,4 +57,11 @@ json.pm_issue_type issue.pm_issue_type
|
||||||
json.pm_sprint_id issue.pm_sprint_id
|
json.pm_sprint_id issue.pm_sprint_id
|
||||||
json.pm_project_id issue.pm_project_id
|
json.pm_project_id issue.pm_project_id
|
||||||
json.time_scale issue.time_scale
|
json.time_scale issue.time_scale
|
||||||
json.child_count issue.child_count
|
json.child_count issue.child_count
|
||||||
|
json.project do
|
||||||
|
if issue.project.present?
|
||||||
|
json.partial! "api/v1/projects/detail", locals: {project: issue.project}
|
||||||
|
else
|
||||||
|
json.nil!
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,26 @@
|
||||||
|
json.(project, :id, :name, :identifier, :description, :forked_count, :praises_count, :forked_from_project_id, :is_public)
|
||||||
|
json.mirror_url project.repository&.mirror_url
|
||||||
|
json.type project.numerical_for_project_type
|
||||||
|
json.praised project.praised_by?(current_user)
|
||||||
|
json.last_update_time render_unix_time(project.updated_on)
|
||||||
|
json.time_ago time_from_now(project.updated_on)
|
||||||
|
json.language do
|
||||||
|
if project.project_language.blank?
|
||||||
|
json.nil!
|
||||||
|
else
|
||||||
|
json.id project.project_language.id
|
||||||
|
json.name project.project_language.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
json.category do
|
||||||
|
if project.project_category.blank?
|
||||||
|
json.nil!
|
||||||
|
else
|
||||||
|
json.id project.project_category.id
|
||||||
|
json.name project.project_category.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
json.topics project.project_topics.each do |topic|
|
||||||
|
json.(topic, :id, :name)
|
||||||
|
end
|
||||||
|
json.url project.full_url
|
Loading…
Reference in New Issue