create_service.rb 404 Bytes
Newer Older
1 2 3 4 5 6 7
module Boards
  class CreateService
    def initialize(project)
      @project = project
    end

    def execute
8 9
      create_board! unless project.board.present?
      project.board
10 11 12 13 14
    end

    private

    attr_reader :project
15 16 17

    def create_board!
      project.create_board
18 19
      project.board.lists.create(list_type: :backlog)
      project.board.lists.create(list_type: :done)
20
    end
21 22
  end
end