Product Resolver
Product
File Name: product.js
File Path: shopping-cart-api/graphql/resolvers/product.js
This Resolver is used to handle all product related queries such as fetching all the product items, fetching product item by category, fetching product item by sub category, creating product item, editing product items and deleting product items.
products
GraphQL Type: Query
Input Type or Parameters: NULL
Description: Gets all the product items
Response Input Type or Response: [Product!]!
Name
Type
_id
ID
title
String!
skuCode
String
description
String!
subCategory
subCategory
attribute
[Attributes!]!
image
[String!]
price
Float
featured
Boolean
isActive
Boolean!
productByCategory
GraphQL Type: Query
Input Type or Parameters String!
Name
Type
Required
subCategory
String
true
Description: Gets all the food items for sub category id.
Response Input Type or Response: [Product!]!
Name
Type
id
ID
title
String!
skuCode
String
description
String!
subCategory
subCategory
attribute
[Attributes!]!
image
[String!]
price
Float
featured
Boolean
isActive
Boolean!
createProduct
GraphQL Type: Mutation
Input Type or Parameters ProductInput!
Name
Type
Required
_id
String
false
title
String!
true
skuCode
String
true
description
String!
true
subCategory
subCategory
false
attribute
[Attributes!]!
true
image
[String!]
false
price
Float
true
featured
Boolean
true
Description: Creates a product item with the following parameters, attributes of a product is for example small, medium, large
Response Input Type or Response: Product!
Name
Type
_id
ID
title
String!
skuCode
String
description
String!
subCategory
subCategory
attribute
[Attributes!]!
image
[String!]
price
Float
featured
Boolean
isActive
Boolean!
editProduct
GraphQL Type: Mutation
Input Type or Parameters: ProductInput
Name
Type
Required
_id
String
false
skuCode
String
false
description
String
false
subCategory
subCategory
true
attribute
[Attributes!]
true
image
[String]
true
price
Float
true
featured
Boolean
true
Description: Gets all the product items for sub category id.
Response Input Type or Response: Product!
Name
Type
_id
ID
title
String!
skuCode
String
description
String!
subCategory
subCategory
attribute
[Attributes!]!
image
[String!]
price
Float
featured
Boolean
isActive
Boolean!
deleteProduct
GraphQL Type: Mutation
Input Type or Parameters String!
Name
Type
Required
id
String
true
Description: Deletes the product item with the id.
Response Input Type or Response: Product!
Name
Type
_id
ID
title
String!
skuCode
String
description
String!
subCategory
subCategory
attribute
[Attributes!]!
image
[String!]
price
Float
featured
Boolean
isActive
Boolean!
Last updated
Was this helpful?