Skip to content

Commit

Permalink
update requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
Diandra Ryan-Mas authored and Diandra Ryan-Mas committed Jul 13, 2019
1 parent cd68392 commit 0d0b3f0
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,34 @@ Design the **data model** for a _recipe book_ application, then use `Knex migrat

The requirements for the system, as stated by the client are:

- have a way to manage dishes. A **dish** is something the client wants to cook, like _pizza_ or _tacos_.
- have a way to manage recipes. A **dish** can have different recipes for tacos, like _tex-mex_ or _granny's_. A **recipe** belongs only to one **dish**.
- have a way to manage recipes.
- have a way to manage ingredients.
- a **recipe** could have more than one **ingredient** and the same **ingredient** can be used in multiple recipes. Examples are _"cup of corn flour"_ or _"gram of butter"_.
- when saving the ingredients for a **recipe** capture the quantity required for that **ingredient** as a floating number.
- have a way to save instructions for cooking a recipe.
- have a way to pick a **dish** and a **recipe** and get a _shopping list_ with all the ingredients, and quantity of each, needed to cook the **dish**.
- have a way to save step by step instructions for preparing a recipe.

**Hint**: Before writing any code, write out all desired tables in the data model and determine all relationships between tables.

### Migrations and Seeds

- Write a migration file that creates all tables necessary to model this data
- Write seed files to populate the tables with test data. **Hint**: Keep your recipes *very* simple or this step could become extremely time consuming.

### Data Access

In addition to the `migrations` and `seeding` scripts, write a data access file that **exports** an object with the following functions:

- `getDishes()`: should return a list of all dishes in the database.
- `addDish(dish)`: should add the **dish** to the database and return the `id` of the new **dish**.
- `getDish(id)`: should return the **dish** with the provided `id` and include a list of the related recipes.
- `getRecipes()`: should return a list of all recipes in the database including the **dish** they belong to.
- `addRecipe(recipe)`: should add a **recipe** to the database and return the `id` of the new **recipe**.
- `getRecipes()`: should return a list of all recipes in the database.
- `getShoppingList(recipe_id)`: should return a list of all ingredients and quantities for a given recipe
- `getInstructions(recipe_id)`: should return a list of step by step instructions for preparing a recipe

Organize and name your files anyway you see fit.

## Stretch Problems

- design and build a RESTful API that makes use of your data access file and publishes endpoints that a client application can use to manage all resources.
- add a method called `getRecipe(id)` to your data access library that should return the recipe with the provided `id`. The recipe should include:
- name of the dish.
- name of the recipe.
- the list of ingredients with the quantity.
- follow the same pattern to add the CRUD operations for other entities in the system.
- add _units of measure_ support for the **ingredient**s.
- design and build a front end client for your API.
- add a `getShoppingList(recipeId)` that returns a list of all the recipe's ingredients including the quantity of each.
## Stretch Problem

Build the following endpoints. Write any additional data access helpers as needed.

- `GET /api/recipes/`: all recipes (need not include details about inrgredients or steps)
- `GET /api/recipes/:id/shoppingList`: a list of ingredients and quantites for a single recipe
- `GET /api/recipes/:id/instructions`: a correctly ordered list of how to prepare a single recipe
- `GET /api/ingredients/:id/recipes`: all recipes in the system that utilize a single ingredient

0 comments on commit 0d0b3f0

Please sign in to comment.