Class: Mutations::JiraImport::Start

Inherits:
BaseMutation
  • Object
show all
Includes:
FindsProject
Defined in:
app/graphql/mutations/jira_import/start.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, 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(project_path:, jira_project_key:, users_mapping:) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/graphql/mutations/jira_import/start.rb', line 31

def resolve(project_path:, jira_project_key:, users_mapping:)
  project = authorized_find!(project_path)
  mapping = users_mapping.to_ary.map(&:to_hash)

  service_response = ::JiraImport::StartImportService
                       .new(context[:current_user], project, jira_project_key, mapping)
                       .execute
  jira_import = service_response.success? ? service_response.payload[:import_data] : nil

  {
    jira_import: jira_import,
    errors: service_response.errors
  }
end