2018-07-16 12:31:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-10-05 15:01:06 -04:00
|
|
|
module Boards
|
2017-08-28 17:56:49 -04:00
|
|
|
class ListService < Boards::BaseService
|
2016-10-05 15:01:06 -04:00
|
|
|
def execute
|
2017-08-28 17:56:49 -04:00
|
|
|
create_board! if parent.boards.empty?
|
2018-03-28 14:32:13 -04:00
|
|
|
boards
|
2016-10-05 15:01:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-03-28 14:32:13 -04:00
|
|
|
def boards
|
|
|
|
parent.boards
|
|
|
|
end
|
|
|
|
|
2016-10-05 15:01:06 -04:00
|
|
|
def create_board!
|
2017-08-28 17:56:49 -04:00
|
|
|
Boards::CreateService.new(parent, current_user).execute
|
2016-10-05 15:01:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|