summaryrefslogtreecommitdiff
path: root/app/graphql/types/projects/service_type_enum.rb
blob: d0cecbfea49ce899838317bc7840ceb626f7dc2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

module Types
  module Projects
    class ServiceTypeEnum < BaseEnum
      graphql_name 'ServiceType'

      class << self
        private

        def type_description(name, type)
          "#{type} type"
        end
      end

      # This prepend must stay here because the dynamic block below depends on it.
      prepend_mod # rubocop: disable Cop/InjectEnterpriseEditionModule

      ::Integration.available_integration_names(include_dev: false).each do |name|
        type = "#{name.camelize}Service"
        domain_value = Integration.integration_name_to_type(name)
        value type.underscore.upcase, value: domain_value, description: type_description(name, type)
      end
    end
  end
end