2016-11-03 12:29:30 +05:30
|
|
|
module Boards
|
2018-03-17 18:26:18 +05:30
|
|
|
class ListService < Boards::BaseService
|
2016-11-03 12:29:30 +05:30
|
|
|
def execute
|
2018-03-17 18:26:18 +05:30
|
|
|
create_board! if parent.boards.empty?
|
2018-05-09 12:01:36 +05:30
|
|
|
boards
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
def boards
|
|
|
|
parent.boards
|
|
|
|
end
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
def create_board!
|
2018-03-17 18:26:18 +05:30
|
|
|
Boards::CreateService.new(parent, current_user).execute
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|