The following assignment was created for barraiser interview, Please do not copy paste and if you do please make sure to change the readme file.
How to run:
- clone project
- cd to project directory
- create and activate virtual environment
- run 'pip install -r requirements.txt'
- run 'python3 manage.py makemigrations'
- run 'python3 manage.py migrate'
- create sample users and products for testing
- run 'python3 managy.py runserver'
Assumptions:
- one deal only has one product
- date format = yyyy-mm-dd hh:mm:ss
Validations:
- complete data check
- offer time check( start time > end time)
- date format check
- Deal duplicity check ( not 2 deals can have same product)
Payloads:
-
Deal Creation Payload: { "product_id":2, "start":"2021-09-10 23:30:00", "end":"2021-09-09 23:30:00", "max":2 }
-
Deal Deletion Payload:
{ "deal_id":2, }
-
Deal claim Payload: { "user_id":2, "deal_id":1, }
-
Deal Update Payload: { "deal_id":1 "product_id":3, "start":"2021-09-10 23:30:00", "end":"2021-09-09 23:30:00", "max":2 }