add currentUser query
This commit is contained in:
@@ -4,14 +4,9 @@ module Types
|
||||
include GraphQL::Types::Relay::HasNodeField
|
||||
include GraphQL::Types::Relay::HasNodesField
|
||||
|
||||
# TODO: remove me
|
||||
field :test_field, [String], null: false,
|
||||
description: "An example field added by the generator"
|
||||
def test_field
|
||||
[
|
||||
SecureRandom.uuid,
|
||||
SecureRandom.uuid,
|
||||
]
|
||||
field :current_user, UserType, null: true
|
||||
def current_user
|
||||
context[:current_user]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
14
app/graphql/types/user_type.rb
Normal file
14
app/graphql/types/user_type.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
module Types
|
||||
class UserType < Types::BaseObject
|
||||
# implements GraphQL::Types::Relay::Node
|
||||
|
||||
global_id_field :id
|
||||
|
||||
field :id, ID, null: false
|
||||
field :first_name, String, null: false
|
||||
field :last_name, String, null: false
|
||||
field :full_name, String, null: false
|
||||
field :email, String, null: false
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user