2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
module Types
|
2019-07-07 11:18:12 +05:30
|
|
|
class QueryType < ::Types::BaseObject
|
2018-11-08 19:23:39 +05:30
|
|
|
graphql_name 'Query'
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
# The design management context object needs to implement #issue
|
|
|
|
DesignManagementObject = Struct.new(:issue)
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
field :project, Types::ProjectType,
|
|
|
|
null: true,
|
|
|
|
resolver: Resolvers::ProjectResolver,
|
2019-07-07 11:18:12 +05:30
|
|
|
description: "Find a project"
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
field :projects, Types::ProjectType.connection_type,
|
|
|
|
null: true,
|
|
|
|
resolver: Resolvers::ProjectsResolver,
|
|
|
|
description: "Find projects visible to the current user"
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
field :group, Types::GroupType,
|
|
|
|
null: true,
|
|
|
|
resolver: Resolvers::GroupResolver,
|
|
|
|
description: "Find a group"
|
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
field :current_user, Types::UserType,
|
|
|
|
null: true,
|
|
|
|
resolve: -> (_obj, _args, context) { context[:current_user] },
|
|
|
|
description: "Get information about current user"
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
field :namespace, Types::NamespaceType,
|
|
|
|
null: true,
|
|
|
|
resolver: Resolvers::NamespaceResolver,
|
|
|
|
description: "Find a namespace"
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
field :metadata, Types::MetadataType,
|
|
|
|
null: true,
|
|
|
|
resolver: Resolvers::MetadataResolver,
|
|
|
|
description: 'Metadata about GitLab'
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
field :snippets,
|
|
|
|
Types::SnippetType.connection_type,
|
|
|
|
null: true,
|
|
|
|
resolver: Resolvers::SnippetsResolver,
|
|
|
|
description: 'Find Snippets visible to the current user'
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
field :design_management, Types::DesignManagementType,
|
|
|
|
null: false,
|
|
|
|
description: 'Fields related to design management'
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
field :milestone, ::Types::MilestoneType,
|
|
|
|
null: true,
|
|
|
|
description: 'Find a milestone',
|
|
|
|
resolve: -> (_obj, args, _ctx) { GitlabSchema.find_by_gid(args[:id]) } do
|
|
|
|
argument :id, ::Types::GlobalIDType[Milestone],
|
|
|
|
required: true,
|
|
|
|
description: 'Find a milestone by its ID'
|
|
|
|
end
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
field :user, Types::UserType,
|
|
|
|
null: true,
|
|
|
|
description: 'Find a user',
|
|
|
|
resolver: Resolvers::UserResolver
|
|
|
|
|
|
|
|
field :users, Types::UserType.connection_type,
|
|
|
|
null: true,
|
|
|
|
description: 'Find users',
|
|
|
|
resolver: Resolvers::UsersResolver
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
field :echo, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Text to echo back',
|
|
|
|
resolver: Resolvers::EchoResolver
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
def design_management
|
|
|
|
DesignManagementObject.new(nil)
|
|
|
|
end
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
Types::QueryType.prepend_if_ee('EE::Types::QueryType')
|