Coder Social home page Coder Social logo

user-transactions-api's Introduction

User Transactions API

API to manage user transactions.

Documentation

An OpenApi Swagger documentation. http://localhost:8000/docs/

Goals

  1. Can create users by receiving: name, email and age
  2. List all users and also and see the details of a specific user
  3. Can save users' transactions.
  4. To get some summary reports.

Usage

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

Tests

To run the tests.

python manage.py test
coverage run --source='.' manage.py test
coverage report (93% coverage) 

Lint

pipenv run lint

Examples

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"

Contact

Eduardo Gasser - [email protected]

user-transactions-api's People

Watchers

Edu Gasser avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.