Sub Category Resolver
SubCategory
File Name: subCategory.js
File Path: shopping-cart-api/graphql/resolvers/subCategory.js
This Resolver is used for managing sub categories mainly for web dashboard use. CRUD operations are performed over here namely creating sub category, fetching sub categories, editing sub categories and deleting sub categories.
createSubCategory
GraphQL Type: Mutation
Input Type or Parameters: SubCategory
Name
Type
Required
_id
String
false
title
String
true
image
Upload
false
category
String
true
Description: Creates a sub category with image for the image for menu screen and category for main category ID.
Response Input Type or Response: SubCategory!
Name
Type
_id
ID
title
String
image
String
category
String
isActive
Boolean
subCategories
GraphQL Type: Query
Input Type or Parameters Not needed
Description: Fetches all the sub categories
Response Input Type or Response: [SubCategory!]!
Name
Type
_id
ID
title
String
image
String
category
String
isActive
String
editSubCategory
GraphQL Type: Mutation
Input Type or Parameters: SubCategoryInput
Name
Type
Required
_id
String
false
title
String
true
image
Upload
false
category
String
tt\rue
Description: Edits sub category for given _id.
Response Input Type or Response: SubCategory!
Name
Type
_id
ID
title
String
image
String
category
String
isActive
String
deleteCategory
GraphQL Type: Mutation
Input Type or Parameters: id
Name
Type
Required
id
String
true
Description: Deletes Sub Category for given id deleting doesn't delete it from database but only sets the isActive flag to false
Response Input Type or Response: SubCategory!
Name
Type
_id
ID
title
String
image
String
category
String
isActive
String
Last updated
Was this helpful?