diff options
Diffstat (limited to 'app/graphql/mutations/jira_import/start.rb')
-rw-r--r-- | app/graphql/mutations/jira_import/start.rb | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/app/graphql/mutations/jira_import/start.rb b/app/graphql/mutations/jira_import/start.rb index 6b80c9f8ca4..3df26d33711 100644 --- a/app/graphql/mutations/jira_import/start.rb +++ b/app/graphql/mutations/jira_import/start.rb @@ -3,7 +3,7 @@ module Mutations module JiraImport class Start < BaseMutation - include Mutations::ResolvesProject + include ResolvesProject graphql_name 'JiraImportStart' @@ -23,29 +23,21 @@ module Mutations description: 'Project name of the importer Jira project' def resolve(project_path:, jira_project_key:) - project = find_project!(project_path: project_path) - - raise_resource_not_available_error! unless project + project = authorized_find!(full_path: project_path) service_response = ::JiraImport::StartImportService .new(context[:current_user], project, jira_project_key) .execute jira_import = service_response.success? ? service_response.payload[:import_data] : nil - errors = service_response.error? ? [service_response.message] : [] + { jira_import: jira_import, - errors: errors + errors: service_response.errors } end private - def find_project!(project_path:) - return unless project_path.present? - - authorized_find!(full_path: project_path) - end - def find_object(full_path:) resolve_project(full_path: full_path) end |