https://github.com/avigawande/daily-expense-sharing-application
Assignment Backend Intern - Daily Expense Sharing Application
https://github.com/avigawande/daily-expense-sharing-application
backend flask mongodb python
Last synced: 2 months ago
JSON representation
Assignment Backend Intern - Daily Expense Sharing Application
- Host: GitHub
- URL: https://github.com/avigawande/daily-expense-sharing-application
- Owner: AviGawande
- Created: 2024-10-20T15:23:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-21T03:06:47.000Z (over 1 year ago)
- Last Synced: 2025-05-16T10:41:20.186Z (about 1 year ago)
- Topics: backend, flask, mongodb, python
- Language: Python
- Homepage:
- Size: 13.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### This is the Backend Intern - Assignment for Backend Intern at Convin.ai
## Objective:
Daily Expense Sharing Application
### Technology Used:
- 1.Language and Framework:
- Python
- Flask
- 2.Database:
- MongoDB .
- MongoDB Compass
- 3.Testing:
- Used Postman for Testing Client URLs.
### API Endpoints:
- 1.User Endpoint.
- Create User(POST).
- Retrieve User Details(GET).
- 2.Expense Endpoint.
- Add Expense(POST)
- Retrieve Individual User Expenses(GET).
- Retrieve Overall Expenses(GET).
- Download Balance Sheet(GET).
## How to SetUp this project locally and Test the Results:
- 1.Fork/Clone this repo:
- `git clone https://github.com/AviGawande/Daily-Expense-Sharing-Application`
- 2.In the same directory create a virtual environment(venv):
- Install dependencies if not. `pip install virtualenv`
- Create a new Virtual.Env name myenv. `python -m venv myenv`
- Activate the Virtual-Environment(myenv). `myenv\Scripts\activate`
- 3.CD into the project directory of clonned project:
- `cd Daily-Expense-Sharing-Application`
- Install the Requirements file for project:
- `pip install -r requirements. txt `
- 4.Run this command on the terminal(ensure to activate the virtualenv and install the dependencies):
- `flask run `
- visit this url `http://127.0.0.1:5000/` on browser.
- 5.And your backend system is running locally.
# Results:
I have attached the snapshots of the each enpoint working successfully along with Collection of Postman URLs.
- 1.Create User:
- Method: POST
- URL: `http://localhost:5000/users`
- Body(raw JSON):
```
{
"email": "abhishek123@gmail.com",
"name": "Abhishek Gawande",
"mobile": "1111122222"
}
```
- 
- 2.Retrieve User Details:
- Method: GET
- URL: `http://localhost:5000/users/`
(Replace with the ID returned when creating a user)--> Connect the backend-app with database(MongoDB) to get the IDs.
- 
- 3.Add Expense:
- Method: POST
- URL: `http://localhost:5000/expenses`
- a. For Equal Split:
```
{
"amount": 3000,
"description": "Dinner",
"payer_id": "",
"split_method": "equal",
"splits": [
{"user_id": ""},
{"user_id": ""},
{"user_id": ""}
]
}
```
-
- b.For Exact Split:
```
{
"amount": 4299,
"description": "Shopping",
"payer_id": "",
"split_method": "exact",
"splits": [
{"user_id": "", "amount": 799},
{"user_id": "", "amount": 2000},
{"user_id": "", "amount": 1500}
]
}
```
- 
- c. For Percentage Split:
```
{
"amount": 1000,
"description": "Party",
"payer_id": "",
"split_method": "percentage",
"splits": [
{"user_id": "", "percentage": 50},
{"user_id": "", "percentage": 25},
{"user_id": "", "percentage": 25}
]
}
```
- 
- 4.Retrieve Individual User Expenses :
- Method: GET
- URL: `http://localhost:5000/expenses/user/`
- (Replace with an actual user ID)
- 
- 5.Retrieve Overall Expenses :
- Method: GET
- URL: ` http://localhost:5000/expenses`
- 
- 6.Download the Balance Sheet:
- Method: GET
- URL: `http://localhost:5000/balance-sheet/download`
- 
## I am also posting the Postman Collection here where i tested all the API Enpoints:
https://www.postman.com/abhigawande123/workspace/convin/collection/36164059-b00fba34-3f3d-4d1e-b194-7f689ef1d507?action=share&creator=36164059