Skip to content

Ingredient

Narendra Syahrasyad edited this page Apr 1, 2020 · 5 revisions

Ingredient Service

Running

  1. Make sure to download the latest dev.env file and place it in /config/.
  2. Go to /ingredient, then run npm i && npm start.

Purpose

The ingredient service is responsible for:

  1. storing information about individual ingredients that make up recipes
  2. storing user inventories containing owned-ingredients and their quantities

API

/parse

POST /parse

Parses a recipe object

Body

  • recipe - { ingredients: string[] }

Response

  • ingredients - array of ingredient objects, where each ingredient is { id: number, quantity: number, name: string }

/search

GET /search?query=...

Perform a search on the ingredient database by name.

/ingredient

GET /ingredient/:id

Retrieve ingredient data based on an ID

POST /ingredient

Add an ingredient to the database

Body

  • name
  • unitCategory (1 - volume [mL, L,], 2 - weight [g, kg], 3 - units)

PATCH /ingredient/:id

Modify an ingredient within the database

Allowed Updates

  • name
  • unitCategory

DELETE /ingredient/:id

Delete an ingredient from the database

/user

POST /user

Add a user to the database

Body

  • externalId (corresponding user service ID)

DELETE /user/:id

Remove a user from the database

/user/ingredient

GET /user/ingredient/:id

Retrieve a user's ingredient list (by user ID)

POST /user/ingredient/:id

Add a new ingredient to a user's ingredient list

Body

  • ingredientId
  • quantity

PATCH /user/ingredient/:id

Update the quantity of an ingredient to a user's ingredient list (by user ID)

Allowed Updates

  • quantity

DELETE /user/ingredient/:id

Remove an ingredient from a user's ingredient list (by user ID)

Clone this wiki locally