Class: Mutations::Ci::JobArtifact::Destroy

Inherits:
BaseMutation
  • Object
show all
Defined in:
app/graphql/mutations/ci/job_artifact/destroy.rb

Constant Summary collapse

ArtifactID =
::Types::GlobalIDType[::Ci::JobArtifact]

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods inherited from BaseMutation

#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #ready?, #unauthorized_object

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #raise_resource_not_available_error!

Instance Method Details

#find_object(id:) ⇒ Object



23
24
25
# File 'app/graphql/mutations/ci/job_artifact/destroy.rb', line 23

def find_object(id:)
  GlobalID::Locator.locate(id)
end

#resolve(id:) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'app/graphql/mutations/ci/job_artifact/destroy.rb', line 27

def resolve(id:)
  artifact = authorized_find!(id: id)

  if artifact.destroy
    { errors: [] }
  else
    { errors: artifact.errors.full_messages }
  end
end