- database modeling.
- migration scripts.
- seeding.
- knex.
Design the data model for a recipe book application, then use Knex migrations and seeding functionality to build a SQLite3 database based on the model and seed it with test data.
The requirements for the system, as stated by the client are:
- have a way to manage dishes. A
dishis something the client wants to cook like pizza or tacos. - have a way to manage recipes. A
dishcan have different recipes for tacos, like tex-mex or granny's. Arecipebelongs only to onedish. - have a way to manage ingredients.
- a
recipecould 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
recipecapture the quantity required for that ingredient as a floating number. - have a way to save instructions for cooking a recipe. Instructions will be a series of
stepsinvolved in cooking arecipe. - for some recipes, the order in which the steps are performed matters, please provide a way to specify that order.
- have a way to pick a
dishand arecipeand get a shopping list with all the ingredients, and quantity of each, needed to cook thedish.
In addition to the migration and seed 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 thedishto the database and return theidof the newdish.getDish(id): should return thedishwith the providedidand include a list of the related recipes.getRecipes(): should return a list of all recipes in the database including thedishthey belong to.addRecipe(recipe): should add arecipeto the database and return theidof the newrecipe.
Name this file anything you want and place it where it makes the most sense to you.
- 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 providedid. The recipe should include:- name of the dish.
- name of the recipe.
- the list of ingredients with the quantity.
- the list of steps in the order they need to be executed.
- follow the same pattern to add the CRUD operations for other entities in the system.
- add units of measure support for the ingredients.
- add a table of unit of measure convertions, so that we can record the quantity for an ingredient using a unit of measure and see the values for other units reading the recipe.
- design and build a front end client for your API.