remove createUser mutation

This commit is contained in:
João Geonizeli
2021-08-10 21:57:06 -03:00
parent fe072595ed
commit fb99da5550
7 changed files with 1 additions and 157 deletions

View File

@@ -1,16 +0,0 @@
# frozen_string_literal: true
module Mutations
class CreateUser < BaseMutation
field :success, Boolean, null: false
argument :user, Inputs::UserAttributesInput, required: true
def resolve(user:)
User.create!({ **user, email: context[:current_auth].email })
{ success: true }
rescue ActiveRecord::RecordInvalid => e
{ success: false, errors: [e.message] }
end
end
end

View File

@@ -1,6 +1,5 @@
# frozen_string_literal: true
module Types
class MutationType < Types::BaseObject
field :create_user, mutation: Mutations::CreateUser
end
end

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class XStakeSchema < GraphQL::Schema
mutation(Types::MutationType)
# mutation(Types::MutationType)
query(Types::QueryType)
def self.resolve_type(abstract_type, obj, ctx)

View File

@@ -1,39 +1,3 @@
"""
Autogenerated input type of CreateUser
"""
input CreateUserInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
user: UserAttributesInput!
}
"""
Autogenerated return type of CreateUser
"""
type CreateUserPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
Errors encountered during execution of the mutation.
"""
errors: [String!]
success: Boolean!
}
type Mutation {
createUser(
"""
Parameters for CreateUser
"""
input: CreateUserInput!
): CreateUserPayload
}
type Query {
currentUser: User
}
@@ -45,8 +9,3 @@ type User {
id: ID!
lastName: String!
}
input UserAttributesInput {
firstName: String!
lastName: String!
}