Class: Releases::DestroyService

Inherits:
BaseService show all
Includes:
Concerns
Defined in:
app/services/releases/destroy_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#executeObject


7
8
9
10
11
12
13
14
15
16
# File 'app/services/releases/destroy_service.rb', line 7

def execute
  return error('Release does not exist', 404) unless release
  return error('Access Denied', 403) unless allowed?

  if release.destroy
    success(tag: existing_tag, release: release)
  else
    error(release.errors.messages || '400 Bad request', 400)
  end
end