debian-mirror-gitlab/app/graphql/resolvers/merge_request_pipelines_resolver.rb

42 lines
885 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2021-01-29 00:20:46 +05:30
# rubocop: disable Graphql/ResolverType
2018-12-05 23:21:45 +05:30
2018-11-08 19:23:39 +05:30
module Resolvers
class MergeRequestPipelinesResolver < BaseResolver
2021-01-29 00:20:46 +05:30
# The GraphQL type here gets defined in this include
2018-11-08 19:23:39 +05:30
include ::ResolvesPipelines
2021-02-22 17:27:13 +05:30
include ::CachingArrayResolver
2018-11-08 19:23:39 +05:30
alias_method :merge_request, :object
2021-02-22 17:27:13 +05:30
# Return at most 500 pipelines for each MR.
# Merge requests generally have many fewer pipelines than this.
def self.field_options
super.merge(max_page_size: 500)
end
2018-11-08 19:23:39 +05:30
def resolve(**args)
2020-11-24 15:15:51 +05:30
return unless project
2021-02-22 17:27:13 +05:30
super
end
def query_for(args)
resolve_pipelines(project, args).merge(merge_request.all_pipelines)
end
def model_class
::Ci::Pipeline
end
def query_input(**args)
args
2018-11-08 19:23:39 +05:30
end
def project
merge_request.source_project
end
end
end
2021-01-29 00:20:46 +05:30
# rubocop: enable Graphql/ResolverType