创建issue时加上工作项关联

This commit is contained in:
呱呱呱 2023-11-14 16:50:00 +08:00
parent be45e45dbc
commit a644bfee25
2 changed files with 4 additions and 1 deletions

View File

@ -149,7 +149,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
:status_id, :priority_id, :milestone_id,
:branch_name, :start_date, :due_date, :time_scale,
:subject, :description, :blockchain_token_num,
:pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id,
:pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :link_able_id,
issue_tag_ids: [],
assigner_ids: [],
attachment_ids: [],

View File

@ -34,6 +34,7 @@ class Api::V1::Issues::CreateService < ApplicationService
@pm_issue_type = params[:pm_issue_type]
@root_id = params[:root_id]
@time_scale = params[:time_scale]
@belink_able_id = params[:link_able_id]
end
def call
@ -70,6 +71,8 @@ class Api::V1::Issues::CreateService < ApplicationService
@created_issue.changer_id = @current_user.id
@created_issue.save!
@created_issue.pm_links.find_or_create_by(be_linkable_type: 'Issue', be_linkable_id: @belink_able_id) if @belink_able_id.present?
if Site.has_blockchain? && @project.use_blockchain
if @created_issue.blockchain_token_num.present? && @created_issue.blockchain_token_num > 0
Blockchain::CreateIssue.call({user_id: current_user.id, project_id: @created_issue.project_id, token_num: @created_issue.blockchain_token_num})