Commit 5ddd2e67 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '34261-service-desk-to-graphql' into 'master'

Add service desk information to project graphQL endpoint

See merge request gitlab-org/gitlab!20722
parents f4ad0be1 96832db7
...@@ -159,3 +159,5 @@ module Types ...@@ -159,3 +159,5 @@ module Types
resolver: Resolvers::Projects::SnippetsResolver resolver: Resolvers::Projects::SnippetsResolver
end end
end end
Types::ProjectType.prepend_if_ee('::EE::Types::ProjectType')
---
title: Add service desk information to project graphQL endpoint
merge_request: 20722
author:
type: changed
...@@ -4551,6 +4551,16 @@ type Project { ...@@ -4551,6 +4551,16 @@ type Project {
id: ID! id: ID!
): SentryDetailedError ): SentryDetailedError
"""
E-mail address of the service desk.
"""
serviceDeskAddress: String
"""
Indicates if the project has service desk enabled.
"""
serviceDeskEnabled: Boolean
""" """
Indicates if shared runners are enabled on the project Indicates if shared runners are enabled on the project
""" """
......
...@@ -1314,6 +1314,34 @@ ...@@ -1314,6 +1314,34 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "serviceDeskAddress",
"description": "E-mail address of the service desk.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "serviceDeskEnabled",
"description": "Indicates if the project has service desk enabled.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "sharedRunnersEnabled", "name": "sharedRunnersEnabled",
"description": "Indicates if shared runners are enabled on the project", "description": "Indicates if shared runners are enabled on the project",
......
...@@ -668,6 +668,8 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph ...@@ -668,6 +668,8 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| `mergeRequest` | MergeRequest | A single merge request of the project | | `mergeRequest` | MergeRequest | A single merge request of the project |
| `issue` | Issue | A single issue of the project | | `issue` | Issue | A single issue of the project |
| `sentryDetailedError` | SentryDetailedError | Detailed version of a Sentry error on the project | | `sentryDetailedError` | SentryDetailedError | Detailed version of a Sentry error on the project |
| `serviceDeskEnabled` | Boolean | Indicates if the project has service desk enabled. |
| `serviceDeskAddress` | String | E-mail address of the service desk. |
### ProjectPermissions ### ProjectPermissions
......
# frozen_string_literal: true
module EE
module Types
module ProjectType
extend ActiveSupport::Concern
prepended do
field :service_desk_enabled, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if the project has service desk enabled.'
field :service_desk_address, GraphQL::STRING_TYPE, null: true,
description: 'E-mail address of the service desk.'
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe GitlabSchema.types['Project'] do
it 'includes the ee specific fields' do
expected_fields = %w[service_desk_enabled service_desk_address]
is_expected.to include_graphql_fields(*expected_fields)
end
end
...@@ -25,7 +25,7 @@ describe GitlabSchema.types['Project'] do ...@@ -25,7 +25,7 @@ describe GitlabSchema.types['Project'] do
issue pipelines removeSourceBranchAfterMerge sentryDetailedError snippets issue pipelines removeSourceBranchAfterMerge sentryDetailedError snippets
] ]
is_expected.to have_graphql_fields(*expected_fields) is_expected.to include_graphql_fields(*expected_fields)
end end
describe 'issue field' do describe 'issue field' do
......
...@@ -28,6 +28,19 @@ RSpec::Matchers.define :have_graphql_fields do |*expected| ...@@ -28,6 +28,19 @@ RSpec::Matchers.define :have_graphql_fields do |*expected|
end end
end end
RSpec::Matchers.define :include_graphql_fields do |*expected|
expected_field_names = expected.map { |name| GraphqlHelpers.fieldnamerize(name) }
match do |kls|
expect(kls.fields.keys).to include(*expected_field_names)
end
failure_message do |kls|
missing = expected_field_names - kls.fields.keys
"is missing fields: <#{missing.inspect}>" if missing.any?
end
end
RSpec::Matchers.define :have_graphql_field do |field_name, args = {}| RSpec::Matchers.define :have_graphql_field do |field_name, args = {}|
match do |kls| match do |kls|
field = kls.fields[GraphqlHelpers.fieldnamerize(field_name)] field = kls.fields[GraphqlHelpers.fieldnamerize(field_name)]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment