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