Enatega Multivendor
Search…
⌃K

Food Resolver

Food

File Name: food.js
File Path: enatega-multivendor-api/graphql/resolvers/food.js
This Resolver is used to handle all food related queries such as fetching all the food items, fetching food item by category, creating food item, liking food item, liked food items, editing food items and deleting food items.

foods

  • GraphQL Type: Query
  • Input Type or Parameters: NULL
  • Description: Gets all the food items
  • Response Input Type or Response: [Food!]!
Name
Type
_id
ID
title
String!
description
String!
variations
[Variations!]!
email
String
likes
Int
img_url
String!
liked
Boolean
is_active
Boolean!

foodByCategory

  • GraphQL Type: Query
  • Input Type or Parameters String!
Name
Type
Required
category
String
true
  • Description: Gets all the food items for category id.
  • Response Input Type or Response: [Food!]!
Name
Type
_id
ID
title
String!
description
String!
variations
[Variations!]!
email
String
likes
Int
img_url
String!
liked
Boolean
is_active
Boolean!

createFood

  • GraphQL Type: Mutation
  • Input Type or Parameters FoodInput!
Name
Type
Required
_id
String
false
title
String
true
description
String
true
category
String
true
img_url
Upload
false
variations
[VariationInput!]!
true
  • Description: Creates a food item with the following parameters, variations of a food is for example small, medium, large
  • Response Input Type or Response: Food!
Name
Type
_id
ID
title
String!
description
String!
variations
[Variations!]!
email
String
likes
Int
img_url
String!
liked
Boolean
is_active
Boolean!

likeFood

  • GraphQL Type: Query
  • Input Type or Parameters FoodInput!
Name
Type
Required
foodId
String
true
  • Description: Likes the food with id.
  • Response Input Type or Response: Food!
Name
Type
_id
ID
title
String!
description
String!
variations
[Variations!]!
email
String
likes
Int
img_url
String!
liked
Boolean
is_active
Boolean!

likedFood

  • GraphQL Type: Query
  • Input Type or Parameters NULL
  • Description: Returns all liked food by user
  • Response Input Type or Response: [Food!]!
Name
Type
_id
ID
title
String!
description
String!
variations
[Variations!]!
email
String
likes
Int
img_url
String!
liked
Boolean
is_active
Boolean!

editFood

  • GraphQL Type: Mutation
  • Input Type or Parameters: FoodInput
Name
Type
Required
_id
String
false
title
String
true
description
String
true
category
String
true
img_url
Upload
false
variation
[VariationInput!]!
true
  • Description: Gets all the food items for category id.
  • Response Input Type or Response: Food!
Name
Type
_id
ID
title
String!
description
String!
variations
[Variations!]!
email
String
likes
Int
img_url
String!
liked
Boolean
is_active
Boolean!

deleteFood

  • GraphQL Type: Mutation
  • Input Type or Parameters String!
Name
Type
Required
id
String
true
  • Description: Deletes the food item with the id.
  • Response Input Type or Response: Food!
Name
Type
_id
ID
title
String!
description
String!
variations
[Variations!]!
email
String
likes
Int
img_url
String!
liked
Boolean
is_active
Boolean!