summaryrefslogtreecommitdiff
path: root/app/graphql/types/package_type_enum.rb
blob: 6f50c166da3ce2ec6e561ca75e7f50c0f3c80113 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module Types
  class PackageTypeEnum < BaseEnum
    PACKAGE_TYPE_NAMES = {
      pypi: 'PyPI',
      npm: 'NPM'
    }.freeze

    ::Packages::Package.package_types.keys.each do |package_type|
      type_name = PACKAGE_TYPE_NAMES.fetch(package_type.to_sym, package_type.capitalize)
      value package_type.to_s.upcase, "Packages from the #{type_name} package manager", value: package_type.to_s
    end
  end
end