Merge pull request '项目管理-项目工作项接口补充' (#196) from yystopf/forgeplus:pm_project_develop into pm_project_develop
This commit is contained in:
commit
e19eae7733
|
@ -120,8 +120,12 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
|||
return render_not_found("ID为#{id}的疑修不存在!")
|
||||
end
|
||||
end
|
||||
if params[:ids].blank?
|
||||
@issues = Issue.where(pm_project_id: params[:pm_project_id])
|
||||
else
|
||||
@issues = Issue.where(id: params[:ids], pm_project_id: params[:pm_project_id])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def query_params
|
||||
|
|
|
@ -39,12 +39,14 @@
|
|||
# pm_issue_type :integer
|
||||
# time_scale :decimal(10, 2) default("0.00")
|
||||
# child_count :integer default("0")
|
||||
# changer_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_issues_on_assigned_to_id (assigned_to_id)
|
||||
# index_issues_on_author_id (author_id)
|
||||
# index_issues_on_category_id (category_id)
|
||||
# index_issues_on_changer_id (changer_id)
|
||||
# index_issues_on_created_on (created_on)
|
||||
# index_issues_on_fixed_version_id (fixed_version_id)
|
||||
# index_issues_on_priority_id (priority_id)
|
||||
|
@ -90,6 +92,7 @@ class Issue < ApplicationRecord
|
|||
has_many :attach_pull_requests, through: :pull_attached_issues, source: :pull_request
|
||||
# PM 关联工作项目
|
||||
has_many :pm_links, as: :linkable, dependent: :destroy
|
||||
belongs_to :changer, class_name: 'User', foreign_key: :changer_id, optional: true
|
||||
|
||||
scope :issue_includes, ->{includes(:user)}
|
||||
scope :issue_many_includes, ->{includes(journals: :user)}
|
||||
|
|
|
@ -67,6 +67,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
|||
@created_issue.root_id = @root_id
|
||||
@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
|
||||
@created_issue.save!
|
||||
|
||||
if Site.has_blockchain? && @project.use_blockchain
|
||||
|
|
|
@ -71,8 +71,8 @@ class Api::V1::Issues::ListService < ApplicationService
|
|||
|
||||
#pm相关
|
||||
# root_id
|
||||
if pm_project_id.present?
|
||||
issues = issues.where(root_id: root_id.present? ? nil : root_id)
|
||||
if root_id.present?
|
||||
issues = issues.where(root_id: root_id).or(issues.where(id: root_id))
|
||||
end
|
||||
|
||||
# pm_issue_type
|
||||
|
|
|
@ -79,6 +79,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
@updated_issue.time_scale = @time_scale unless @time_scale.nil?
|
||||
|
||||
@updated_issue.updated_on = Time.now
|
||||
@updated_issue.changer_id = current_user.id
|
||||
@updated_issue.save!
|
||||
|
||||
build_after_issue_journal_details if @updated_issue.previous_changes.present? # 操作记录
|
||||
|
|
|
@ -33,6 +33,13 @@ json.author do
|
|||
json.nil!
|
||||
end
|
||||
end
|
||||
json.changer do
|
||||
if issue.changer.present?
|
||||
json.partial! "api/v1/users/simple_user", locals: {user: issue.changer}
|
||||
else
|
||||
json.nil!
|
||||
end
|
||||
end
|
||||
json.assigners issue.show_assigners.each do |assigner|
|
||||
json.partial! "api/v1/users/simple_user", locals: {user: assigner}
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ if user.present?
|
|||
json.type user.type
|
||||
json.name user.real_name
|
||||
json.login user.login
|
||||
json.image_url url_to_avatar(user)
|
||||
json.image_url Rails.application.config_for(:configuration)['platform_url'] + "/" + url_to_avatar(user).to_s
|
||||
else
|
||||
json.nil!
|
||||
end
|
|
@ -1,2 +1,7 @@
|
|||
json.id @attachment.id
|
||||
json.filesize @attachment.filesize
|
||||
json.title @attachment.title
|
||||
json.filesize number_to_human_size(@attachment.filesize)
|
||||
json.is_pdf @attachment.is_pdf?
|
||||
json.url Rails.application.config_for(:configuration)['platform_url'] + (@attachment.is_pdf? ? download_url(@attachment,disposition:"inline") : download_url(@attachment)).to_s
|
||||
json.created_on @attachment.created_on.strftime("%Y-%m-%d %H:%M")
|
||||
json.content_type @attachment.content_type
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddChangerToIssues < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_reference :issues, :changer
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue