Category Resolver

Category

File Name: category.js

File Path: food-delivery-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

String

true

img_menu

Upload

false

img_header

Upload

false

  • Description: Creates a category with img menu for the image for menu screen and img header for the menu items screen

  • Response Input Type or Response: Category!

Name

Type

_id

ID

token

String

title

String

description

String

img_menu

String

img_header

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

description

String

img_menu

String

img_header

String

is_active

String

editCategory

  • GraphQL Type: Mutation

  • Input Type or Parameters: CategoryInput

Name

Type

Required

_id

String

false

title

String

true

description

String

true

img_menu

Upload

false

img_header

Upload

false

  • Description: Edits category for given _id.

  • Response Input Type or Response: Category!

Name

Type

_id

ID

title

String

description

String

img_menu

String

img_header

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

description

String

img_menu

String

img_header

String

is_active

String

Last updated