Commit 31e5c252 authored by Alex Kalderimis's avatar Alex Kalderimis

Minor resolver tidying

This makes a few changes that are nice-to-have now, and become more
important down the line:

- adds some missing types to resolvers (a cop violation)
- removes unnecessary field authorization (field authorization does not
  work like that)
- adds extras annotations for `lookahead` etc
parent 70da6178
......@@ -35,7 +35,6 @@ Graphql/IDType:
Graphql/ResolverType:
Exclude:
- 'app/graphql/resolvers/base_resolver.rb'
- 'app/graphql/resolvers/ci/jobs_resolver.rb'
- 'app/graphql/resolvers/ci/pipeline_stages_resolver.rb'
- 'app/graphql/resolvers/users/group_count_resolver.rb'
- 'ee/app/graphql/resolvers/vulnerabilities_base_resolver.rb'
......
......@@ -5,6 +5,8 @@ module Resolvers
class JobsResolver < BaseResolver
alias_method :pipeline, :object
type ::Types::Ci::JobType.connection_type, null: true
argument :security_report_types, [Types::Security::ReportTypeEnum],
required: false,
description: 'Filter jobs by the type of security report they produce'
......
......@@ -9,6 +9,8 @@ module Resolvers
VersionID = ::Types::GlobalIDType[::DesignManagement::Version]
extras [:parent]
argument :earlier_or_equal_to_sha, GraphQL::STRING_TYPE,
as: :sha,
required: false,
......
......@@ -6,6 +6,8 @@ module Resolvers
type Types::IssueStatusCountsType, null: true
extras [:lookahead]
def continue_issue_resolve(parent, finder, **args)
finder.parent_param = parent
apply_lookahead(Gitlab::IssuablesCountForState.new(finder, parent))
......
......@@ -3,6 +3,8 @@
module Resolvers
module Users
class GroupCountResolver < BaseResolver
type GraphQL::INT_TYPE, null: true
alias_method :user, :object
def resolve(**args)
......
......@@ -19,7 +19,6 @@ module Types
field :locked_by_user, Types::UserType,
null: true,
authorize: :read_user,
description: 'The user currently holding a lock on the Terraform state'
field :locked_at, Types::TimeType,
......
......@@ -15,7 +15,6 @@ module Types
field :created_by_user, Types::UserType,
null: true,
authorize: :read_user,
description: 'The user that created this version'
field :download_path, GraphQL::STRING_TYPE,
......@@ -24,7 +23,6 @@ module Types
field :job, Types::Ci::JobType,
null: true,
authorize: :read_build,
description: 'The job that created this version'
field :serial, GraphQL::INT_TYPE,
......
......@@ -4,6 +4,8 @@ module Resolvers
class SecurityReportSummaryResolver < BaseResolver
type Types::SecurityReportSummaryType, null: true
extras [:lookahead]
alias_method :pipeline, :object
def resolve(lookahead:)
......
......@@ -9,7 +9,6 @@ module Types
field :projects,
Types::ProjectType.connection_type,
null: false,
authorize: :read_project,
description: 'Projects selected in Instance Security Dashboard'
field :vulnerability_scanners,
......
......@@ -15,7 +15,6 @@ module Types
field :projects, Types::ProjectType.connection_type, null: false,
description: 'Projects within this grade',
authorize: :read_project,
complexity: 5
end
# rubocop: enable Graphql/AuthorizeTypes
......
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