新增:疑修新增悬赏金额
This commit is contained in:
parent
18156ffd8d
commit
aba5de8bb8
|
@ -99,7 +99,7 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
||||||
params.permit(
|
params.permit(
|
||||||
:status_id, :priority_id, :milestone_id,
|
:status_id, :priority_id, :milestone_id,
|
||||||
:branch_name, :start_date, :due_date,
|
:branch_name, :start_date, :due_date,
|
||||||
:subject, :description,
|
:subject, :description, :blockchain_token_num,
|
||||||
:issue_tag_ids => [],
|
:issue_tag_ids => [],
|
||||||
:assigner_ids => [],
|
:assigner_ids => [],
|
||||||
:attachment_ids => [],
|
:attachment_ids => [],
|
||||||
|
|
|
@ -4,13 +4,14 @@ class Api::V1::Issues::CreateService < ApplicationService
|
||||||
include Api::V1::Issues::Concerns::Loadable
|
include Api::V1::Issues::Concerns::Loadable
|
||||||
|
|
||||||
attr_reader :project, :current_user
|
attr_reader :project, :current_user
|
||||||
attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description
|
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
|
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login
|
||||||
attr_accessor :created_issue
|
attr_accessor :created_issue
|
||||||
|
|
||||||
validates :subject, presence: true
|
validates :subject, presence: true
|
||||||
validates :status_id, :priority_id, presence: true
|
validates :status_id, :priority_id, presence: true
|
||||||
validates :project, :current_user, presence: true
|
validates :project, :current_user, presence: true
|
||||||
|
validates :blockchain_token_num, numericality: {greater_than: 0}
|
||||||
|
|
||||||
def initialize(project, params, current_user = nil)
|
def initialize(project, params, current_user = nil)
|
||||||
@project = project
|
@project = project
|
||||||
|
@ -23,6 +24,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
||||||
@due_date = params[:due_date]
|
@due_date = params[:due_date]
|
||||||
@subject = params[:subject]
|
@subject = params[:subject]
|
||||||
@description = params[:description]
|
@description = params[:description]
|
||||||
|
@blockchain_token_num = params[:blockchain_token_num]
|
||||||
@issue_tag_ids = params[:issue_tag_ids]
|
@issue_tag_ids = params[:issue_tag_ids]
|
||||||
@assigner_ids = params[:assigner_ids]
|
@assigner_ids = params[:assigner_ids]
|
||||||
@attachment_ids = params[:attachment_ids]
|
@attachment_ids = params[:attachment_ids]
|
||||||
|
@ -94,6 +96,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
||||||
issue_attributes.merge!({start_date: start_date}) if start_date.present?
|
issue_attributes.merge!({start_date: start_date}) if start_date.present?
|
||||||
issue_attributes.merge!({due_date: due_date}) if due_date.present?
|
issue_attributes.merge!({due_date: due_date}) if due_date.present?
|
||||||
issue_attributes.merge!({branch_name: branch_name}) if branch_name.present?
|
issue_attributes.merge!({branch_name: branch_name}) if branch_name.present?
|
||||||
|
issue_attributes.merge!({blockchain_token_num: blockchain_token_num}) if blockchain_token_num.present?
|
||||||
|
|
||||||
issue_attributes
|
issue_attributes
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Api::V1::Issues::ListService < ApplicationService
|
||||||
|
|
||||||
validates :category, inclusion: {in: %w(all opened closed), message: "请输入正确的Category"}
|
validates :category, inclusion: {in: %w(all opened closed), message: "请输入正确的Category"}
|
||||||
validates :participant_category, inclusion: {in: %w(all aboutme authoredme assignedme atme), message: "请输入正确的ParticipantCategory"}
|
validates :participant_category, inclusion: {in: %w(all aboutme authoredme assignedme atme), message: "请输入正确的ParticipantCategory"}
|
||||||
validates :sort_by, inclusion: {in: ['issues.created_on', 'issues.updated_on', 'issue_priorities.position'], message: '请输入正确的SortBy'}, allow_blank: true
|
validates :sort_by, inclusion: {in: ['issues.created_on', 'issues.updated_on', 'issues.blockchain_token_num', 'issue_priorities.position'], message: '请输入正确的SortBy'}, allow_blank: true
|
||||||
validates :sort_direction, inclusion: {in: %w(asc desc), message: '请输入正确的SortDirection'}, allow_blank: true
|
validates :sort_direction, inclusion: {in: %w(asc desc), message: '请输入正确的SortDirection'}, allow_blank: true
|
||||||
validates :current_user, presence: true
|
validates :current_user, presence: true
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class Api::V1::Issues::ListService < ApplicationService
|
||||||
issues = issues.where(status_id: status_id) if status_id.present?
|
issues = issues.where(status_id: status_id) if status_id.present?
|
||||||
|
|
||||||
# keyword
|
# keyword
|
||||||
issues = issues.ransack(subject_or_description_cont: keyword).result if keyword.present?
|
issues = issues.ransack(id_eq: params[:keyword]).result.or(issues.ransack(subject_or_description_cont: keyword).result) if keyword.present?
|
||||||
|
|
||||||
@total_issues_count = issues.distinct.size
|
@total_issues_count = issues.distinct.size
|
||||||
@closed_issues_count = issues.closed.distinct.size
|
@closed_issues_count = issues.closed.distinct.size
|
||||||
|
|
|
@ -4,11 +4,12 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
||||||
include Api::V1::Issues::Concerns::Loadable
|
include Api::V1::Issues::Concerns::Loadable
|
||||||
|
|
||||||
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
|
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
|
attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login
|
||||||
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
|
||||||
|
validates :blockchain_token_num, numericality: {greater_than: 0}
|
||||||
|
|
||||||
def initialize(project, issue, params, current_user = nil)
|
def initialize(project, issue, params, current_user = nil)
|
||||||
@project = project
|
@project = project
|
||||||
|
@ -22,6 +23,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
||||||
@due_date = params[:due_date]
|
@due_date = params[:due_date]
|
||||||
@subject = params[:subject]
|
@subject = params[:subject]
|
||||||
@description = params[:description]
|
@description = params[:description]
|
||||||
|
@blockchain_token_num = params[:blockchain_token_num]
|
||||||
@issue_tag_ids = params[:issue_tag_ids]
|
@issue_tag_ids = params[:issue_tag_ids]
|
||||||
@assigner_ids = params[:assigner_ids]
|
@assigner_ids = params[:assigner_ids]
|
||||||
@attachment_ids = params[:attachment_ids]
|
@attachment_ids = params[:attachment_ids]
|
||||||
|
@ -94,6 +96,7 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
||||||
@updated_issue.due_date = due_date unless due_date.nil?
|
@updated_issue.due_date = due_date unless due_date.nil?
|
||||||
@updated_issue.subject = subject if subject.present?
|
@updated_issue.subject = subject if subject.present?
|
||||||
@updated_issue.description = description unless description.nil?
|
@updated_issue.description = description unless description.nil?
|
||||||
|
@updated_issue.blockchain_token_num = blockchain_token_num unless blockchain_token_num.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_assigner_participants
|
def build_assigner_participants
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
json.(issue, :id, :subject, :project_issues_index, :description, :branch_name, :start_date, :due_date)
|
json.(issue, :id, :subject, :project_issues_index, :description, :branch_name, :start_date, :due_date, :blockchain_token_num)
|
||||||
json.created_at issue.created_on.strftime("%Y-%m-%d %H:%M")
|
json.created_at issue.created_on.strftime("%Y-%m-%d %H:%M")
|
||||||
json.updated_at issue.updated_on.strftime("%Y-%m-%d %H:%M")
|
json.updated_at issue.updated_on.strftime("%Y-%m-%d %H:%M")
|
||||||
json.tags issue.show_issue_tags.each do |tag|
|
json.tags issue.show_issue_tags.each do |tag|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
json.(issue, :id, :subject, :project_issues_index)
|
json.(issue, :id, :subject, :project_issues_index, :blockchain_token_num)
|
||||||
json.created_at issue.created_on.strftime("%Y-%m-%d %H:%M")
|
json.created_at issue.created_on.strftime("%Y-%m-%d %H:%M")
|
||||||
json.updated_at issue.updated_on.strftime("%Y-%m-%d %H:%M")
|
json.updated_at issue.updated_on.strftime("%Y-%m-%d %H:%M")
|
||||||
json.tags issue.show_issue_tags.each do |tag|
|
json.tags issue.show_issue_tags.each do |tag|
|
||||||
|
|
Loading…
Reference in New Issue