summaryrefslogtreecommitdiff
path: root/app/services/boards/destroy_service.rb
blob: 8f3d4b58b7be87aac33c0162859611811b7b7f63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module Boards
  class DestroyService < Boards::BaseService
    def execute(board)
      if parent.boards.size == 1
        return ServiceResponse.error(message: "The board could not be deleted, because the parent doesn't have any other boards.")
      end

      board.destroy!

      ServiceResponse.success
    end
  end
end