splitwise
splitwise copied to clipboard
splitwise LLD and django rest interface
Splitwise REST Interface - Python/Django
REST based interface for Splitwise
NOTE
names have been used as unique ids just for the sake of presentation, real world app should be based on UUID.
Setup
- Docker Based
Prerequisites
- Docker
- run command
docker-compose --build
docker-compose up -d
This will expose 0.0.0.0:8000 port for API.
- Local Setup
Prerequisites
- Python 3.9
- Pip
pip install -r requirements.txt
- Run the command
python manage.py makemigrations && python manage.py migrate && python manage.py runserver 8000This will start the server at localhost:8000
For Usage - Use postman collection provided alongside code
Import the collection to postman and you will be able to see the endpoints and use them Also set an environment variable in postman
Variable Name = url
Variable Value = http://127.0.0.1:8000/api [local setup] or http://0.0.0.0:8000/api [for docker setup]
The API Supports the below operations though rest endpoints:
- Create User [/createUser]
- Create Group [/createGroup]
- Add member to group [/addUserToGroup]
- Add personal expense between 2 existing users [/addExpense]
- Add group expense [/addExpense]
- Show Group Expenses [/groupDetails]
- Show Group Members [/showGroupMembers]
- Show the user details [/userDetails]
- Record a personal payment [/recordPayment]
- Record a group payment [/recordPayment]
- Delete a user [/deleteUser]
- Delete a group [/deleteGroup]
Test Cases
Test cases are available in splitwise/tests.py
To run the test cases, run the command python manage.py test