GithubHelp home page GithubHelp logo

usersnack-test-case's Introduction

Usersnack

Tech Stack

  • Django: Backend
  • Django Rest Framework: addons for Django
  • Postgres: Database

Other tools

  • Pytest: testing framework
  • Flake8: Linter
  • Black: Formatter

Live app

A live version of the service is running on Heroku here: https://evening-scrubland-88960.herokuapp.com. It might take a few seconds for the service to spin up after a period of inactivity.

Local setup

  • Change permissions on entrypoint.sh
    chmod +x backend/app/entrypoint.sh
  • Run containers
    docker-compose up -d
    

Endpoints

  • /api/pizzas/

    This endpoint is supposed to provide data for the Pizza list view.

    curl --location --request GET 'http://127.0.0.1:8000/api/pizzas/'
    
  • /api/extras/

    This endpoint is supposed to provide data for the extra dropdowns.

    curl --location --request GET 'http://127.0.0.1:8000/api/extras/'
    
  • /api/createorder/

    This endpoint is for creating a new order.

    curl --location --request POST 'http://127.0.0.1:8000/api/createorder/' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "base_pizza": 1,
        "extras": [
            {
                "extra": 15,
                "quantity": 1
            },
            {
                "extra": 16,
                "quantity": 5
            }
        ],
        "user_name": "Dhruv",
        "user_address": "Wien"
    }'
    
  • /api/orders/<id>/

    This endpoint returns the details of a specific order, including component items, and total price.

    curl --location --request GET 'http://127.0.0.1:8000/api/orders/1'
    
  • /api/orders/

    This endpoint returns all orders.

    curl --location --request GET 'http://127.0.0.1:8000/api/orders/'
    

Postman

Postman collection containing the above requests can be found under the postman directory.

Tests

docker-compose exec backend pytest tests

To Do

  • Add Swagger documentation using drf-yasg.
  • Change item_type (in table FoodItem) to a relationship instead of CharField. (done to save time).

usersnack-test-case's People

Contributors

dhth 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.