Class: Mutations::Projects::BranchRules::SquashOptions::Update

Inherits:
BaseMutation
  • Object
show all
Defined in:
app/graphql/mutations/projects/branch_rules/squash_options/update.rb

Constant Summary

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, authorization_scopes, 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?, #find_object, #raise_resource_not_available_error!

Instance Method Details

#resolve(branch_rule_id:, squash_option:) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/graphql/mutations/projects/branch_rules/squash_options/update.rb', line 25

def resolve(branch_rule_id:, squash_option:)
  branch_rule = authorized_find!(id: branch_rule_id)

  service_response = ::Projects::BranchRules::SquashOptions::UpdateService.new(
    branch_rule,
    squash_option: squash_option,
    current_user: current_user
  ).execute

  {
    squash_option: (service_response.payload if service_response.success?),
    errors: service_response.errors
  }
end