User Resolvers

User

File Name: user.js

File Path: shopping-cart-api/graphql/resolvers/auth.js

Auth Resolver handles queries related to User it handles creating user, handling user profile, handling admin login, getting all users and update user information.

createUser

  • GraphQL Type: Mutation

  • Input Type or Parameters: userInput

Name

Type

Required

phone

String

false

email

String

true

password

String

false

name

String

false

addresses

[Address!]

false

  • Description: Creates a new User with above mentioned parameters. Once a user is registered an account creation email is sent to the user. A token is also sent as a response with user id and user information.

  • Response Input Type or Response: AuthData

Name

Type

userId

ID

token

String

name

String

phone

String

email

String

addresses

[Address!]

updateUser

  • GraphQL Type: Mutation

  • Input Type or Parameters

Name

Type

Required

name

String

true

phone

String

true

addresses

String

true

  • Description: Updates User information

  • Response Input Type or Response: AuthData

Name

Type

name

ID

phone

String

addresses

Address

  • Address Input Type: Address

Name

Type

Required

label

String

true

region

String

true

city

String

true

apartment

String

true

building

String

true

details

String

false

selected

Boolean

false

profile

  • GraphQL Type: Query

  • Input Type or Parameters: No user parameters is needed as auth token is sent on every request

  • Description: Gets User profile.

  • Response Input Type or Response: AuthData

Name

Type

name

ID

phone

String

email

String

addresses

[Address!]

adminLogin

  • GraphQL Type: Mutation

  • Input Type or Parameters

Name

Type

Required

email

String

true

password

String

true

  • Description: Login resolver for admin dashboard

  • Response Input Type or Response: Type Admin

Name

Type

userId

ID

name

String

email

String

token

String

users

  • GraphQL Type: Query

  • Input Type or Parameters:

  • Description: All the users are retrieved queried from admin panel

  • Response Input Type or Response: [User]

Name

Type

_id

ID

name

String

phone

String

email

String

password

String

payment_type

PaymentType

card_information

CardInformation

addresses

Address

orders

[Order!]!

is_active

Boolean

Last updated

Was this helpful?