Coder Social home page Coder Social logo

node-db4-challenge's Introduction

Recipe Book

Topics

  • database modeling.
  • migration scripts.
  • seeding.
  • knex.

Assignment

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 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 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:

  • 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 Problem

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

  • GET /api/recipes/: all recipes (without details about ingredients 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

node-db4-challenge's People

Contributors

luishrd avatar ericathompson avatar mixelpixel avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.