base_query.rb 518 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class BaseQuery < GraphQL::Schema::Resolver
  4. include Gql::Concerns::HandlesAuthorization
  5. include Gql::Concerns::HasNestedGraphqlName
  6. description 'Base class for all queries'
  7. # Require authentication by default for queries.
  8. def self.authorize(_obj, ctx)
  9. ctx.current_user
  10. end
  11. def self.register_in_schema(schema)
  12. schema.field graphql_field_name, resolver: self
  13. end
  14. end
  15. end