Module: Types::Analytics::Aggregation::EngineResponseType

Defined in:
app/graphql/types/analytics/aggregation/engine_response_type.rb

Class Method Summary collapse

Class Method Details

.build(engine, graphql_context) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/graphql/types/analytics/aggregation/engine_response_type.rb', line 8

def build(engine, graphql_context)
  adapter = ::Gitlab::Database::Aggregation::Graphql::Adapter
  types_prefix = adapter.types_prefix(graphql_context[:types_prefix])

  Class.new(BaseObject) do
    include BaseResponseType
    graphql_name "#{types_prefix}AggregationResponse"
    description "Response for #{types_prefix} aggregation engine"

    field :dimensions,
      Types::Analytics::Aggregation::EngineResponseDimensionsType.build(engine, **graphql_context),
      resolver_method: :object,
      description: 'Aggregation dimensions. Every selected dimension will be used for aggregation.'

    engine.metrics.each { |metric| declare_parameterized_field(metric) }
  end
end