diff options
Diffstat (limited to 'app/services/boards/lists/base_update_service.rb')
-rw-r--r-- | app/services/boards/lists/base_update_service.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/services/boards/lists/base_update_service.rb b/app/services/boards/lists/base_update_service.rb index faf58e405fc..bcb7d6c8504 100644 --- a/app/services/boards/lists/base_update_service.rb +++ b/app/services/boards/lists/base_update_service.rb @@ -3,16 +3,30 @@ module Boards module Lists class BaseUpdateService < Boards::BaseService + extend ::Gitlab::Utils::Override + def execute(list) if execute_by_params(list) success(list: list) else - error(list.errors.messages, 422) + message = list.errors.empty? ? 'The update was not successful.' : list.errors.messages + + error(message, { list: list }) end end private + override :error + def error(message, pass_back = {}) + ServiceResponse.error(message: message, http_status: :unprocessable_entity, payload: pass_back) + end + + override :success + def success(pass_back = {}) + ServiceResponse.success(payload: pass_back) + end + def execute_by_params(list) update_preferences_result = update_preferences(list) if can_read?(list) update_position_result = update_position(list) if can_admin?(list) |