Code Monkey home page Code Monkey logo

fridient's Introduction

Fridient

A fresh Ingridients API

Usage

To get started, make sure you have Docker installed on your system, and then clone this repository.

Then, open a terminal (GitBash for Windows) and from this cloned respository's root, run

- docker-compose up -d --build.

Open up your browser of choice to http://localhost:8080 and you should see your Laravel app running as intended.

- docker-compose run --rm composer update

- docker-compose run --rm artisan migrate --seed

View End points

The following are the application end-points

  1. One endpoint to create an ingredient
    To create an ingredient you must supply name, measure, supplier.
    The API responds with an object of the ingredient
    The measure is a unit of measure such as g, kg, pieces. Depending on whether it is 200grams of sugar or perhaps 8 potatoes.

    Suppliers and Ingredients, can be created as follows

  2. One endpoint to list ingredients
    This should list all ingredients and should be paginated.

  3. One endpoint to create a recipe
    To create a recipe you must supply name, description and an array of ingredients and the amount of the ingredient required
    The description is a free text field to describe the recipe steps.
    The ingredients array includes an amount of each ingredient required and maps back to the measure required for that ingredient from the ingredients endpoint.

    • Send POST request to URL below
      http://localhost:8080/api/v1/recipes
      Body of the request data sample:
      { "name" : "potato salad", "descrption" : "lorem amet ipsum musec it just sample desc pction", "ingredients" : ["{'ingredient_id':8,'amount':6}","{'ingredient_id':1,'amount':4}","{'ingredient_id':6,'amount':8}"] }
  4. One endpoint to list recipes
    This should list all recipes and should be paginated\

  5. One endpoint to create a box for a user
    A box is an order from a customer which includes up to 4 recipes
    To create a box you must supply a delivery_date which is any date in the future along with an array of recipe IDs (up to 4) that the user would like to receive.
    The endpoint should return failures for invalid recipe IDs or delivery_dates in the past or within the next 48 hours.
    The API should respond with an object of the box.\

  6. One endpoint to view the ingredients required to be ordered by the company

    Upon supplying an order_date the API must response with the ingredients and amount of each ingredient which should be ordered to fulfill all orders for the 7 days from the order_date.

NOTE:

Order date should be in format of: YYYY-mm-dd e.g. 2020-05-02

For better experience creating and testing use: POSTMAN

To be Improved:

Create a pivot table that could store recipe_id, ingredient_id, and amount i.e. a table will be link for recipes and ingredients, and then store the array of ids in recipes table - ingredients column for easier data storing and fetching.

  • lead to massive code improvement and performance

fridient's People

Contributors

ammwinchande avatar dependabot[bot] avatar

Watchers

James Cloos avatar  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.