Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/syamreddy99/daily-expenses-sharing-application
A Java Spring Boot application for managing and sharing daily expenses among users, featuring user management, expense splitting, and downloadable balance sheets.
https://github.com/syamreddy99/daily-expenses-sharing-application
dailyexpense-api expensesmanagement hibernate java maven mysql spring springboot usermanagementsystem
Last synced: 6 days ago
JSON representation
A Java Spring Boot application for managing and sharing daily expenses among users, featuring user management, expense splitting, and downloadable balance sheets.
- Host: GitHub
- URL: https://github.com/syamreddy99/daily-expenses-sharing-application
- Owner: syamreddy99
- Created: 2024-07-27T18:16:59.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-05T15:26:24.000Z (3 months ago)
- Last Synced: 2024-08-05T17:47:22.741Z (3 months ago)
- Topics: dailyexpense-api, expensesmanagement, hibernate, java, maven, mysql, spring, springboot, usermanagementsystem
- Language: Java
- Homepage: https://github.com/syamreddy99/Daily-Expenses-Sharing-Application
- Size: 80.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ฆ Daily Expenses Sharing Application
## Table of Contents
- [๐ Introduction](#-introduction)
- [โจ Features](#-features)
- [๐ป Technologies Used](#-technologies-used)
- [๐ Getting Started](#-getting-started)
- [๐ Prerequisites](#-prerequisites)
- [๐ง Installation](#-installation)
- [โ๏ธ Configuration](#%EF%B8%8Fconfiguration)
- [โถ๏ธ Running the Application](#%EF%B8%8Frunning-the-application)
- [๐ API Endpoints](#api-endpoints)
- [๐ฅ User Endpoints](#user-endpoints)
- [๐ฐ Expenses Endpoints](#expenses-endpoints)
- [๐๏ธ Database Structure](#%EF%B8%8Fdatabase-structure)# ๐ Introduction
The Daily Expenses Sharing Application allows users to add expenses and split them among participants using three different methods: equal splits, exact amounts, and percentages. The application also provides features for user management and generates downloadable balance sheets.## โจ Features
### User Management:
- ๐คCreate and retrieve user details.
### Expense Management:
- ๐ธ Add expenses and split them in multiple ways.
- โ Validate inputs to ensure data integrity.
- ๐ Generate balance sheets for individual users and overall expenses.## ๐ป Technologies Used
- โ **Java 17** ![Java](https://img.shields.io/badge/-Java-007396?style=flat&logo=java&logoColor=white)
- ๐ฅ๏ธ **Spring Boot** ![SpringBoot](https://img.shields.io/badge/-SpringBoot-6DB33F?style=flat&logo=springboot&logoColor=white)
- ๐๏ธ **Hibernate** ![Hibernate](https://img.shields.io/badge/-Hibernate-59616B?style=flat&logo=hibernate&logoColor=white)
- ๐ข๏ธ **MySQL** ![MySQL](https://img.shields.io/badge/-MySQL-4479A1?style=flat&logo=mysql&logoColor=white)
- ๐ฆ **Apache Maven** ![Maven](https://img.shields.io/badge/-Maven-C71A36?style=flat&logo=apache-maven&logoColor=white)
- ๐ **Lombok** ![Lombok](https://img.shields.io/badge/-Lombok-2C2D72?style=flat&logo=lombok&logoColor=white)## ๐ Getting Started
### ๐ Prerequisites
Before you begin, ensure you have the following installed:
- โ **Java 17** or above ![Java](https://img.shields.io/badge/-Java-007396?style=flat&logo=java&logoColor=white)
- ๐ ๏ธ **Apache Maven** ![Maven](https://img.shields.io/badge/-Maven-C71A36?style=flat&logo=apache-maven&logoColor=white)
- ๐ข๏ธ **MySQL Workbench** ![MySQL](https://img.shields.io/badge/-MySQL-4479A1?style=flat&logo=mysql&logoColor=white)
- ๐ฅ๏ธ **Eclipse** or **Spring Tool Suite** ![Eclipse](https://img.shields.io/badge/-Eclipse-2C2D72?style=flat&logo=eclipse&logoColor=white)
- ๐จ **Postman** ![Postman](https://img.shields.io/badge/-Postman-FF6C37?style=flat&logo=postman&logoColor=white)### ๐ง Installation
1. **Clone the Repository**:
```bash
git clone https://github.com/syamreddy99/Daily-Expenses-Sharing-Application
cd Daily-Expense-Sharing-Application# โ๏ธconfiguration
### Database Configuration:Create a database named "dailyexpenses".
### Update"application.properties":- spring.application.name= `Daily-Expenses-Sharing-Application`
- server.port= `9982`
- This property sets the port number on which the Spring Boot application will run.By default, Spring Boot applications run on port 8080, but this can be
changed as needed.
- spring.datasource.url= `jdbc:mysql://localhost:3306/DailyExpenses`
- This property defines the JDBC URL for connecting to the MySQL database. It specifies the database type, host, port, and the nameof the database.
- spring.datasource.username= `root`- Defines the username for the database connection .
- spring.datasource.password= `root`- Specifies the password for the database connection.
- spring.datasource.driver-class-name= `com.mysql.cj.jdbc.Driver`- Specifies the fully qualified name of the JDBC driver.
- spring.jpa.hibernate.ddl-auto= `update`- Defines the behavior of the Hibernate's automatic schema generation. update creates the schema if it doesn't exist and updates it if it does.
- spring.jpa.show-sql= `true`- Enables logging of SQL statements generated by Hibernate.
- logging.level.org.springframework= `DEBUG`- Sets the logging level for Spring framework classes.
### โถ๏ธRunning the Application
- Import the Project: Unzip the project file and import it into your IDE (e.g., Eclipse).
- Create the Database: Create a MySQL database named DailyExpenses.
- Adjust Configuration: Modify the application.properties as needed.
- Run the Application: Start the application from your IDE.# ๐API Endpoints
### Base URL
- `http://localhost:9982`
## ๐ฅUser Endpoints### Create User
- Method: POST
- URL: `/api/users`
- Description: Creates a new user.
### Request Body:
- {
- "email": "[email protected]",
- "name": "John Doe",
- "mobile": "1234567890"
- }
- Response: Status: 201 Created
- Body: UserDTO object
### Retrieve User Details
- Method: GET
- URL: ` /api/users/{id}`
- Description: Retrieves details of a user by ID.
- Example URL: `/api/users/1`
- Response: Status: 200 OK
- Body: UserDTO object## ๐ฐExpenses Endpoints
### Add Expenses
- Method: POST
- URL: `/api/expenses`
- Description: Adds a new expense.
### Request Body:
- {
- "description": "Dinner",
- "amount": 120.50,
- "date": "2023-07-27",
- "userId": 1,
- "splits": [- {
- "userId": 1,
- "amount": 40.17,
- "splitType": "EQUAL"
- }
- {
- "userId": 2,
- "amount": 40.17,
- "splitType": "EQUAL"
- }
- {
- "userId": 3,
- "amount": 40.16,
- "splitType": "EQUAL"
- }
- ]
- Response: Status: 201 Created
- Body: ExpenseDTO object### Retrieve Individual User Expenses
- Method: GET- URL: `/api/expenses/user/{userId}`
- Description: Retrieves all expenses for a specific user by user ID.
- Example URL: `/api/expenses/user/1`
- Response: Status: 200 OK
- Body: List of ExpenseDTO objects
-
### Retrieve Overall Expenses
- Method: GET
- URL: `/api/expenses/overall`
- Description: Retrieves all expenses in the system.
- Response: Status: 200 OK
- Body: List of ExpenseDTO objects
### Download Balance Sheet
- Method: GET
- URL: `/api/expenses/download/{userId}`
- Description: Generates and downloads a balance sheet for a specific user.
- Example URL: `/api/expenses/download/1`
- Response: Status: 200 OK
- Headers:
- Content-Disposition: attachment; filename=balance_sheet.csv
- Content-Type: `application/csv`
- Body: CSV file
## ๐๏ธDatabase Structure- The database structure consists of the following tables:
### users:
- Stores user details such as email, name, and mobile number.
### expenses:
- Stores expense details including description, amount, date, and user ID.
### splits:
- Stores information about how expenses are split among users.