Code Monkey home page Code Monkey logo

order-feedback-api's Introduction

Nikita Sinhal's Order Feedback API

Part 1

Heroku Hosted:

   Configuration: $ bundle install

   Database creation: $ rails db:migrate

   Database initialization: $ rails db:seed
    - Clears the DB
    - Creates 10 meals
    - Creates 5 delivery orders that contains any number of order items ranging from 1 to 5

   Test instructions: $ rspec spec

   Deployment instructions: $ rails server

Built on:

Rails 5 Postgres rspec

Models

ERD

Sample API JSON response

Path: /orders

{
  "orders": [
    {
      "order_id": "GO123",
      "delivery_date": "2017-10-20",
      "delivery_time": "11:00–11:30AM"
    },
    {
      "order_id": "GO124",
      "delivery_date": "2017-10-20",
      "delivery_time": "11:00–11:30AM"
    }
  ]
}

Path: /orders/:order_id

{
  "order": {
    "order_id": "GO123",
    "delivery_date": "2017-10-20",
    "delivery_time": "11:00–11:30AM",
    "order_items": [
      {
        "name": "Buffalo Chicken on Sweet Potato Mash and Celery Confit ",
        "quantity": 2,
        "total_price": 2390
      }
    ]
  }
}

Gems used:

gem 'rspec-rails' gem 'shoulda' gem 'factory_bot_rails' (formerly knows as factory-girl)

Part II

Users will be able to make 1 delivery feedback, and n number of meal feedback per order, where n is the number of order items that the order contains.

GET: /orders
{
  "orders": [
    {
      "id": 123,
      "order_id": "GO123",
      "delivery_date": "2017-10-20",
      "delivery_time": "11:00–11:30AM",
      "feedback_submitted": false,
      "order_items": [
        {
          "order_item_id": 1,
          "name": "Buffalo Chicken on Sweet Potato Mash and Celery Confit"
        },
        {
          "order_item_id": 2,
          "name": "Chocolate Banana Crumble Tart with praline & caramel sauce"
        }
      ]
    }
    POST: /orders/:order_id/feedbacks
    {
      "feedbacks": [
        {
          "ratable_id": 123,
          "ratable_type": "DeliveryOrder",
          "comment": "Delivery was prompt and rider was kind, but he forgot cutleries"
        },
        {
          "ratable_id": 1,
          "ratable_type": "OrderItem",
          "comment": "The food portion was too little, was alittle hungry after"
        }
        {
          "ratable_id": 2,
          "ratable_type": "OrderItem",
          "comment": "It was super tasty and I loved it"
        }
      ]
    }
Example response:
{
  "status": "OK"
}
GET: /orders/:order_id/feedbacks
{
  "feedbacks": [
    {
      "ratable_id": 123,
      "ratable_type": "DeliveryOrder",
      "rating": 4,
      "comment": "Delivery was prompt and rider was kind, but he forgot cutleries"
    },
    {
      "ratable_id": 1,
      "ratable_type": "OrderItem",
      "rating": 3,
      "comment": "The food portion was too little, was alittle hungry after"
    }
    {
      "ratable_id": 2,
      "ratable_type": "OrderItem",
      "rating": 5,
      "comment": "It was super tasty and I loved it"
    }
  ]
}

order-feedback-api's People

Contributors

nikitas89 avatar

Stargazers

 avatar

Watchers

 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.