API to manage user transactions.
An OpenApi Swagger documentation. http://localhost:8000/docs/
- Can create users by receiving: name, email and age
- List all users and also and see the details of a specific user
- Can save users' transactions.
- To get some summary reports.
You can use the docker container:
docker build . -t api
docker run -v $(pwd):/app/ -itp 8000:8000 --name api api
Or installing the pipenv library and installing the dependencies. Make sure you have Python 3.8.
sudo apt-get update
sudo apt-get install python3.8
pipenv install --dev
python manage.py migrate
python manage.py setup_demo
python manage.py runserver
To run the tests.
python manage.py test
coverage run --source='.' manage.py test
coverage report (93% coverage)
pipenv run lint
The app creates some demo registers.
- Api user: demo / 123
It's necessary a basic authentication.
curl --user "demo:123" -X GET http://localhost:8000/api/users/ -H "Content-Type: application/json"
curl --user "demo:123" -X GET http://localhost:8000/api/users/1/ -H "Content-Type: application/json"
curl --user "demo:123" -X GET http://localhost:8000/api/users/1/summary-by-account/ -H "Content-Type: application/json"
curl --user "demo:123" -X GET http://localhost:8000/api/users/1/summary-by-category/ -H "Content-Type: application/json"
curl --user "demo:123" -X POST http://localhost:8000/api/users/ -d '{"name": "Jane Doe", "email": "[email protected]", "age": 23}' -H "Content-Type: application/json"
curl --user "demo:123" -X POST http://localhost:8000/api/users/1/transactions/ -d '[{"reference": "000055", "account": "C0009", "date": "2020-01-03","amount": "-51.13", "type": "outflow", "category": "groceries", "user": 1}]' -H "Content-Type: application/json"
Eduardo Gasser - [email protected]