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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
408 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)
2021-04-29 21:17:54 +05:30
if boards.size == 1
2020-11-24 15:15:51 +05:30
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
2021-04-29 21:17:54 +05:30
private
def boards
parent.boards
end
2019-09-30 21:07:59 +05:30
end
end