summaryrefslogtreecommitdiff
path: root/app/serializers/analytics/cycle_analytics/configuration_entity.rb
blob: 45ea7c927586a9d322782f41b75725d4d1a8a350 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Analytics
  module CycleAnalytics
    class ConfigurationEntity < Grape::Entity
      include RequestAwareEntity

      expose :events, using: Analytics::CycleAnalytics::EventEntity
      expose :stages, using: Analytics::CycleAnalytics::StageEntity

      private

      def events
        (stage_events.events - stage_events.internal_events).sort_by(&:name)
      end

      def stage_events
        Gitlab::Analytics::CycleAnalytics::StageEvents
      end
    end
  end
end