Commit b03d6d6a authored by k0va1's avatar k0va1 Committed by Brett Walker

Connect BoardType into the group / project query

and add remaining specs
parent 5aca1bd5
...@@ -46,6 +46,12 @@ module Types ...@@ -46,6 +46,12 @@ module Types
field :milestones, Types::MilestoneType.connection_type, null: true, field :milestones, Types::MilestoneType.connection_type, null: true,
description: 'Find milestones', description: 'Find milestones',
resolver: Resolvers::MilestoneResolver resolver: Resolvers::MilestoneResolver
field :boards,
Types::BoardType.connection_type,
null: true,
description: 'Boards of the group',
resolver: Resolvers::BoardsResolver
end end
end end
......
...@@ -179,6 +179,12 @@ module Types ...@@ -179,6 +179,12 @@ module Types
null: true, null: true,
description: 'Paginated collection of Sentry errors on the project', description: 'Paginated collection of Sentry errors on the project',
resolver: Resolvers::ErrorTracking::SentryErrorCollectionResolver resolver: Resolvers::ErrorTracking::SentryErrorCollectionResolver
field :boards,
Types::BoardType.connection_type,
null: true,
description: 'Boards of the project',
resolver: Resolvers::BoardsResolver
end end
end end
......
---
title: 'GraphQL: Add Board type'
merge_request: 22497
author: Alexander Koval
type: added
...@@ -368,6 +368,59 @@ ...@@ -368,6 +368,59 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "boards",
"description": "Boards of the project",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "BoardConnection",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "containerRegistryEnabled", "name": "containerRegistryEnabled",
"description": "Indicates if the project stores Docker container images in a container registry", "description": "Indicates if the project stores Docker container images in a container registry",
...@@ -3122,6 +3175,59 @@ ...@@ -3122,6 +3175,59 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "boards",
"description": "Boards of the group",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "BoardConnection",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "description", "name": "description",
"description": "Description of the namespace", "description": "Description of the namespace",
...@@ -4322,6 +4428,177 @@ ...@@ -4322,6 +4428,177 @@
], ],
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "OBJECT",
"name": "BoardConnection",
"description": "The connection type for Board.",
"fields": [
{
"name": "edges",
"description": "A list of edges.",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "BoardEdge",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "nodes",
"description": "A list of nodes.",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Board",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pageInfo",
"description": "Information to aid in pagination.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "PageInfo",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "BoardEdge",
"description": "An edge in a connection.",
"fields": [
{
"name": "cursor",
"description": "A cursor for use in pagination.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "node",
"description": "The item at the end of the edge.",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "Board",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Board",
"description": null,
"fields": [
{
"name": "id",
"description": "ID (global ID) of the board",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": "Name of the board",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "weight",
"description": "Weight of the board",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "Epic", "name": "Epic",
......
...@@ -49,6 +49,14 @@ An emoji awarded by a user. ...@@ -49,6 +49,14 @@ An emoji awarded by a user.
| `type` | EntryType! | Type of tree entry | | `type` | EntryType! | Type of tree entry |
| `webUrl` | String | Web URL of the blob | | `webUrl` | String | Web URL of the blob |
## Board
| Name | Type | Description |
| --- | ---- | ---------- |
| `id` | ID! | ID (global ID) of the board |
| `name` | String | Name of the board |
| `weight` | Int | Weight of the board |
## Commit ## Commit
| Name | Type | Description | | Name | Type | Description |
......
# frozen_string_literal: true
require 'spec_helper'
describe GitlabSchema.types['Board'] do
it 'includes the ee specific fields' do
expect(described_class).to have_graphql_field('weight')
end
end
# frozen_string_literal: true
require 'spec_helper'
describe GitlabSchema.types['Board'] do
it { expect(described_class.graphql_name).to eq('Board') }
it { expect(described_class).to require_graphql_authorizations(:read_board) }
it 'has specific fields' do
expected_fields = %w[id name]
is_expected.to include_graphql_fields(*expected_fields)
end
end
...@@ -16,9 +16,17 @@ describe GitlabSchema.types['Group'] do ...@@ -16,9 +16,17 @@ describe GitlabSchema.types['Group'] do
web_url avatar_url share_with_group_lock project_creation_level web_url avatar_url share_with_group_lock project_creation_level
subgroup_creation_level require_two_factor_authentication subgroup_creation_level require_two_factor_authentication
two_factor_grace_period auto_devops_enabled emails_disabled two_factor_grace_period auto_devops_enabled emails_disabled
mentions_disabled parent mentions_disabled parent boards
] ]
is_expected.to include_graphql_fields(*expected_fields) is_expected.to include_graphql_fields(*expected_fields)
end end
describe 'boards field' do
subject { described_class.fields['boards'] }
it 'returns boards' do
is_expected.to have_graphql_type(Types::BoardType.connection_type)
end
end
end end
...@@ -24,6 +24,7 @@ describe GitlabSchema.types['Project'] do ...@@ -24,6 +24,7 @@ describe GitlabSchema.types['Project'] do
namespace group statistics repository merge_requests merge_request issues namespace group statistics repository merge_requests merge_request issues
issue pipelines removeSourceBranchAfterMerge sentryDetailedError snippets issue pipelines removeSourceBranchAfterMerge sentryDetailedError snippets
grafanaIntegration autocloseReferencedIssues suggestion_commit_message environments grafanaIntegration autocloseReferencedIssues suggestion_commit_message environments
boards
] ]
is_expected.to include_graphql_fields(*expected_fields) is_expected.to include_graphql_fields(*expected_fields)
...@@ -77,4 +78,10 @@ describe GitlabSchema.types['Project'] do ...@@ -77,4 +78,10 @@ describe GitlabSchema.types['Project'] do
it { is_expected.to have_graphql_type(Types::EnvironmentType.connection_type) } it { is_expected.to have_graphql_type(Types::EnvironmentType.connection_type) }
it { is_expected.to have_graphql_resolver(Resolvers::EnvironmentsResolver) } it { is_expected.to have_graphql_resolver(Resolvers::EnvironmentsResolver) }
end end
describe 'boards field' do
subject { described_class.fields['boards'] }
it { is_expected.to have_graphql_type(Types::BoardType.connection_type) }
end
end end
...@@ -32,6 +32,9 @@ describe 'getting projects' do ...@@ -32,6 +32,9 @@ describe 'getting projects' do
end end
before do before do
# we don't care how many SQL queries the spec takes
stub_const("Gitlab::QueryLimiting::Transaction::THRESHOLD", 1000)
group.add_owner(user) group.add_owner(user)
end end
......
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