docker-compose build
docker-compose run web python manage.py migrate
docker-compose run web python manage.py load_fixture
docker-compose run web python manage.py test
docker-compose up
https://0.0.0.0:8000/
Order data can be created via interact tool in the doc.
https://0.0.0.0:8000/api/v1/
Order can be created by using user and restaurant ids from fixture.
import coreapi
client = coreapi.Client()
schema = client.get("https://0.0.0.0:8000/")
action = ["orders", "create"]
params = {
"user": 1,
"restaurant": 1,
"orderitem_set": [
{"product": 1, "quantity": 3},
{"product": 2, "quantity": 5}
]
}
result = client.action(schema, action, params=params)
import coreapi
client = coreapi.Client()
schema = client.get("https://0.0.0.0:8000/")
action = ["orders", "process"]
params = {
"id": 1,
"status": "COMPLETED|REJECTED",
}
result = client.action(schema, action, params=params)
This action normally running from celery-beat by using order process service per 2 minutes for waiting orders. It can be reviewed on ysapi/celery.py file to configuration.