Class: Releases::DestroyService

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

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#description, #execute_hooks, #existing_tag, #inexistent_milestones, #initialize, #milestones, #name, #param_for_milestone_titles_provided?, #project_group_id, #ref, #release, #released_at, #repository, #tag_name

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

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 Releases::BaseService

Instance Method Details

#executeObject


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

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