kamhaj / eMenu-app

App to create restaurant menus online

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Application using API calls
to display/create/edit/delete restaurant menus online.



Deployed on Heroku (look at navbar for possible further steps):



Django + DRF utilized.

Celery + Redis used for running periodic tasks

(sending emails everyday at 10 a.m.)
(no third party email service specified, requires configuration)

Documentation in Swagger:


https://github.com/axnsan12/drf-yasg





API usage:

https://kamhaj-emenu-app.herokuapp.com/swagger/

model Dish:
GET methods - no authorization
POST, PUT, DELETE - Token authorization

  1. GET - to get Dish details

  2. GET - to get Dishes list

  3. POST - to create Dish object, ImageField included, Django Parsers used

  4. PUT - to update Dish fields, ImageField included, Django Parsers used

  5. DELETE - to delete Dish

model Menu:
GET methods - no authorization
POST, PUT, DELETE - Token authorization

  1. GET - to get Menu details

  2. GET - to get Menus list (non empty, meaning - with at least one Dish)

  3. POST - to create Menu object, Dish objects added by specifying a list of their IDs
    (e.g. dishes: [{"pk":1}, {"pk": 3}, {"pk": 6}] )

  4. PUT - to update Menu fields, Dish objects added by specifying a list of their IDs
    (e.g. dishes: [{"pk":1}, {"pk": 3}, {"pk": 7}]. Old dishes will be removed).

  5. DELETE - to delete Menu





Swagger authorization

  1. Click "Authorize" button
  2. Provide "Token <token_value>"





Run project locally

  1. Clone repo
  2. Set up virtual environment (venv) and activate it
	virtualenv venv
	venv\Scripts\activate     (Windows)
  1. Install required libraries
	pip install -r requirements.txt
  1. Run Redis service (in CMD) to store/process tasks (download from here: https://github.com/ServiceStack/redis-windows)
	redis-server.exe redis.windows.conf
  1. Run a Celery worker (in separate CMD) to pick up tasks (sample task invoked every minute was provided for testing purposes)
	celery -A restaurant worker -l INFO
  1. Run app on localhost and access it in a broswer (localhost:8000)
	python manage.py runserver





Running tests:

	coverage run --source='.' manage.py test 

Getting tests coverage report:

	coverage report --omit=venv/*





Additional info:

  1. Periodic task (emails sending) can be run on demand (as Django custom command)
	python manage.py email-report
  1. API only: listing Dishes and Menus can be sorted
    (by adding parameters to URL,
    e.g. https://kamhaj-emenu-app.herokuapp.com/api/eMenu/dish/list_dishes/?sort=name )
  2. Sqlite3 db was used.





TODO

  • add pagination

About

App to create restaurant menus online


Languages

Language:Python 85.5%Language:HTML 12.2%Language:CSS 2.4%