locales.rb 588 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class Locales < BaseQuery
  4. description 'Locales available in the system'
  5. argument :only_active, Boolean, required: false, description: 'Fetch only active locales'
  6. type [Gql::Types::LocaleType, { null: false }], null: false
  7. def self.authorize(...)
  8. true # This query should be available for all (including unauthenticated) users.
  9. end
  10. def resolve(only_active: false)
  11. return Locale.where(active: true) if only_active
  12. Locale.all
  13. end
  14. end
  15. end