Skip to content

davydov-d/UserExpenses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

This is a test task for a job posted by Pageloot.

It is not a production-ready setup, as it uses development server and sql-lite db, does not use Docker etc. It requires Linux (Ubuntu) to run with python 3.10+, and virtualenv.

To start the app:

  • pip install virtualenv
  • python -m virtualenv .venv --python=python3
  • source .venv/bin/activate
  • pip install -r requirements.txt
  • cd use_expenses/
  • python manage.py migrate
  • python manage.py createsuperuser
  • python manage.py runserver
  • Create user via the admin page: http://127.0.0.1:8000/admin/expenses/user/

Now you can use the API:

curl -H 'Content-Type:application/json' --data '{"user": "[email protected]", "title": "junk food", "amount": "142.43", "category": "food"}' -X POST 'http://127.0.0.1:8000/expenses/' -i
curl -X GET 'http://127.0.0.1:8000/expenses/' -i
curl -X GET 'http://127.0.0.1:8000/expenses/3/' -i
curl -X PUT -H 'Content-Type:application/json' --data '{"user": "[email protected]", "title": "updated title", "amount": "111.11", "category": "other"}' 'http://127.0.0.1:8000/expenses/3/' -i
curl -X PATCH -H 'Content-Type:application/json' --data '{"amount": "222.22"}' 'http://127.0.0.1:8000/expenses/3/' -i
curl -X GET 'http://127.0.0.1:8000/expenses/3/' -i
curl -X GET 'http://127.0.0.1:8000/users/[email protected]/expenses/?start_date=2025-11-02&end_date=2026-09-01' -i
curl -X GET 'http://127.0.0.1:8000/users/[email protected]/expenses_by_category/?date=2025-11-02

The API is described via DRF browsable web API available at http://127.0.0.1:8000/ (no auth required).

Initial estimate included possible use of db like PostgreSQL with docker compose, web/app server, start up scripts, tests/linters etc, but it's not used here to reduce time spent.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages