2016-11-03 12:29:30 +05:30
|
|
|
module Boards
|
|
|
|
module Issues
|
2018-03-17 18:26:18 +05:30
|
|
|
class CreateService < Boards::BaseService
|
|
|
|
attr_accessor :project
|
|
|
|
|
|
|
|
def initialize(parent, project, user, params = {})
|
|
|
|
@project = project
|
|
|
|
|
|
|
|
super(parent, user, params)
|
|
|
|
end
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
def execute
|
|
|
|
create_issue(params.merge(label_ids: [list.label_id]))
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def board
|
2018-03-17 18:26:18 +05:30
|
|
|
@board ||= parent.boards.find(params.delete(:board_id))
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def list
|
|
|
|
@list ||= board.lists.find(params.delete(:list_id))
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_issue(params)
|
|
|
|
::Issues::CreateService.new(project, current_user, params).execute
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|