Welcome to mirror list, hosted at ThFree Co, Russian Federation.

contact_sort_enum.rb « customer_relations « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bb11d741368f28a10fd46972488516ab36e5c1fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Types
  module CustomerRelations
    class ContactSortEnum < SortEnum
      graphql_name 'ContactSort'
      description 'Values for sorting contacts'

      sortable_fields = ['First name', 'Last name', 'Email', 'Phone', 'Description', 'Organization']

      sortable_fields.each do |field|
        value "#{field.upcase.tr(' ', '_')}_ASC",
          value: { field: field.downcase.tr(' ', '_'), direction: :asc },
          description: "#{field} in ascending order."
        value "#{field.upcase.tr(' ', '_')}_DESC",
          value: { field: field.downcase.tr(' ', '_'), direction: :desc },
          description: "#{field} in descending order."
      end
    end
  end
end