Auth Resolvers

Auth

File Name: auth.js

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

Auth Resolver handles queries related to User it handles login, handling user profile, handling admin login, getting all users, forgot password functionality and password reset functionality.

login

  • GraphQL Type: Mutation

  • Input Type or Parameters

Name

Type

Required

email

String

true

password

String

false

type

String

true

  • Description: Logins a User with email and password. type flag is used to check if the user is using social auth for authentication for example google or facebook. The response is sent with AuthData input type.

  • Response Input Type or Response: AuthData

Name

Type

userId

ID

token

String

name

String

phone

String

email

String

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

pushToken

  • GraphQL Type: Mutation

  • Input Type or Parameters

Name

Type

Required

token

String

true

  • Description: When a token is sent user data can be queried

  • 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!

createdAt

String!

updatedAt

String!

forgotPassword

  • GraphQL Type: Mutation

  • Input Type or Parameters

Name

Type

Required

email

String

true

  • Description: Sends a link with forgot password token in email to user

resetPassword

  • GraphQL Type: Mutation

  • Input Type or Parameters

Name

Type

Required

password

String

true

token

String

true

  • Description: Changes user password by verifying the token first

Last updated