debian-mirror-gitlab/app/services/boards/destroy_service.rb

16 lines
358 B
Ruby
Raw Normal View History

2019-09-30 21:07:59 +05:30
# frozen_string_literal: true
module Boards
class DestroyService < Boards::BaseService
def execute(board)
2020-11-24 15:15:51 +05:30
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
2019-09-30 21:07:59 +05:30
2020-11-24 15:15:51 +05:30
board.destroy!
ServiceResponse.success
2019-09-30 21:07:59 +05:30
end
end
end