Rates CRUD Task
For The Get Requirements part I have implemented it with two different DB design:
- The first one is the same as the one you gave me you find it under resources/rates.sql
- In the second one which is under resources/rates_new.sql I have merged regions and ports tables to one table and I call it locations and I have added a type filed to specify if the location is a port or region or maybe something new in the future (let's say airport) here is the design of the new DB I noticed also that new DB design perform much better in some type of queries and the same in most queries I setup for the that a profiling decorator (you find it here).
API Documentation
Please export Doc/postman/ratetask.postman_collection.json file to your postman workspace to explore the api
Setup
if you are using mac you need to install postgres in your machine to be able to install dependencies in requirements.txt
brew install postgresql
Dependencies
Note: in some case I got compilation error while installing psycopg2
sudo pip install -r requirements.txt
Run app
Run the docker container
docker build -t ratestask . # to be run only first time
docker run -p 0.0.0.0:5432:5432 --name ratestask ratestask
Rename the .env_copy to .env
mv .env_copy .env
Run the app
python app.py
Test
pytest test*