Sha256: 0be3899715d5c50a91e5575c3f68fc5732a7c064610303c886a74d6f3804c4a2
Contents?: true
Size: 845 Bytes
Versions: 5
Compression:
Stored size: 845 Bytes
Contents
# frozen_string_literal: true module Types class QueryType < BaseObject field_class GraphqlDevise::Types::BaseField if Gem::Version.new(GraphQL::VERSION) >= Gem::Version.new('2.0') field :user, resolver: Resolvers::UserShow field :public_field, String, null: false, authenticate: false field :private_field, String, null: false, authenticate: true field :vip_field, String, null: false, authenticate: ->(user) { user.is_a?(User) && user.vip? } def public_field if context[:current_resource] "Authenticated user on public field: #{context[:current_resource].email}" else 'Field does not require authentication' end end def private_field 'Field will always require authentication' end def vip_field 'Field available only for VIP Users' end end end
Version data entries
5 entries across 5 versions & 1 rubygems