38 lines
1.3 KiB
Ruby
38 lines
1.3 KiB
Ruby
class Pm::IssuesController < ApplicationController
|
|
before_action :require_login, except: [:index]
|
|
|
|
def index
|
|
@project = Project.find_by_id(params[:project_id]) || Project.new(id: 0, user_id: 0, name: 'pm_mm', identifier: 'pm_mm')
|
|
@object_result = Api::V1::Issues::ListService.call(@project, query_params, current_user)
|
|
@total_issues_count = @object_result[:total_issues_count]
|
|
@opened_issues_count = @object_result[:opened_issues_count]
|
|
@closed_issues_count = @object_result[:closed_issues_count]
|
|
if params[:only_name].present?
|
|
@issues = kaminary_select_paginate(
|
|
@object_result[:data].select(:id, :subject, :project_issues_index, :updated_on, :created_on))
|
|
else
|
|
@issues = kaminari_paginate(@object_result[:data])
|
|
end
|
|
end
|
|
|
|
def create
|
|
project = Project.find_by_id(params[:project_id]) || Project.new(id: 0, user_id: 0, name: 'pm_mm', identifier: 'pm_mm')
|
|
@object_result = Api::V1::Issues::CreateService.call(project, issue_params, current_user)
|
|
end
|
|
|
|
private
|
|
|
|
def issue_params
|
|
params.permit(
|
|
:status_id, :priority_id, :milestone_id,
|
|
:branch_name, :start_date, :due_date,
|
|
:subject, :description, :blockchain_token_num,
|
|
:pm_project_id, :pm_sprint_id, :pm_issue_type,
|
|
issue_tag_ids: [],
|
|
assigner_ids: [],
|
|
attachment_ids: [],
|
|
receivers_login: []
|
|
)
|
|
end
|
|
end
|