Enatega Multivendor
Search…
⌃K

Order Resolver

Order

File Name: order.js
File Path: enatega-multivendor-api/graphql/resolvers/order.js
This Resolver is used to handle all order related queries. For example getting a single order, getting all orders of the user, getting all order in the database, placing an order, editing an order, canceling an order, updating order status, giving rating and review to an order, getting all reviews of the user.

order

  • GraphQL Type: Query
  • Input Type or Parameters: String!
Name
Type
Required
id
String
true
  • Description: Gets the order for particular id
  • Response Input Type or Response: Order!
Name
Type
_id
ID
order_id
String!
delivery_address
String!
items
[Item!]!
user
User!
payment_method
String
paid_amount
Float
payment_status
String!
order_status
String!
review
Review
status_queue
OrderStatus
is_active
Boolean!

orders

  • GraphQL Type: Query
  • Input Type or Parameters: NULL
  • Description: Gets the order of particular user
  • Response Input Type or Response: [Order!]!
Name
Type
_id
ID
order_id
String!
delivery_address
String!
items
[Item!]!
user
User!
payment_method
String
paid_amount
Float
payment_status
String!
order_status
String!
review
Review
status_queue
OrderStatus
is_active
Boolean!

allOrders

  • GraphQL Type: Query
  • Input Type or Parameters: NULL
  • Description: Gets the orders of all Users.
  • Response Input Type or Response: [Order!]!
Name
Type
_id
ID
order_id
String!
delivery_address
String!
items
[Item!]!
user
User!
payment_method
String
paid_amount
Float
payment_status
String!
order_status
String!
review
Review
status_queue
OrderStatus
is_active
Boolean!

placeOrders

  • GraphQL Type: Mutation
  • Input Type or Parameters: [OrderInput!]!, paymentMethod:String
Name
Type
Required
food
String
true
quantity
Int
true
variation
Int
true
  • Description: Gets all the orders of a particular User
  • Response Input Type or Response: Order!
Name
Type
_id
ID
order_id
String!
delivery_address
String!
items
[Item!]!
user
User!
payment_method
String
paid_amount
Float
payment_status
String!
order_status
String!
review
Review
status_queue
OrderStatus
is_active
Boolean!

editOrder

  • GraphQL Type: Mutation
  • Input Type or Parameters: _id:String! and [OrderInput!]!
Name
Type
Required
food
String
true
quantity
Int
true
variation
Int
true
  • Description: Edits Order of particular _id with given OrderInput parameters
  • Response Input Type or Response: Order!
Name
Type
_id
ID
order_id
String!
delivery_address
String!
items
[Item!]!
user
User!
payment_method
String
paid_amount
Float
payment_status
String!
order_status
String!
review
Review
status_queue
OrderStatus
is_active
Boolean!

cancelOrder

  • GraphQL Type: Mutation
  • Input Type or Parameters: OrderId:String!
Name
Type
Required
OrderId
String
true
  • Description: Sets the order status to cancel
  • Response Input Type or Response: Order!
Name
Type
_id
ID
order_id
String!
delivery_address
String!
items
[Item!]!
user
User!
payment_method
String
paid_amount
Float
payment_status
String!
order_status
String!
review
Review
status_queue
OrderStatus
is_active
Boolean!

updateOrderStatus

  • GraphQL Type: Mutation
  • Input Type or Parameters: orderId:String! and status:String!
Name
Type
Required
orderId
String
true
status
String
true
  • Description: Changes the status of the order done from admin panel which sends a push notification to mobile app
  • Response Input Type or Response: Order!
Name
Type
_id
ID
order_id
String!
delivery_address
String!
items
[Item!]!
user
User!
payment_method
String
paid_amount
Float
payment_status
String!
order_status
String!
review
Review
status_queue
OrderStatus
is_active
Boolean!

reviewOrder

  • GraphQL Type: Mutation
  • Input Type or Parameters: reviewInput!
Name
Type
Required
orderId
String
true
rating
Int
true
description
String
false
  • Description: Gives review to a order
  • Response Input Type or Response: Review!
Name
Type
_id
ID
order
Order!
rating
Int!
description
String
is_active
Boolean!

reviews

  • GraphQL Type: Query
  • Input Type or Parameters: NULL
  • Description: Gets all the reviews of the user
  • Response Input Type or Response: [ReviewOutput!]!
Name
Type
_id
ID!
order_id
String!
review
Review!
is_active
Boolean!