In this project we have developed a comprehensive system for managing car rental operations, including vehicle records, customer information, rental transactions, and branch management. The system provides functionalities for creating, updating, retrieving, and deleting details about cars, customers, rentals, and branches.
- @arthurW1935 Sourashis
- @yashathwani Yash
- @TUSHAR1651 Tushar
- @Souvik-Cyclic Souvik
- @aannaannyaaa Ananya
- @garvit420 Garvit
- Clone the repository to your local machine using the command
git clone https://github.com/arthurW1935/car-rental-backend.git
. - We recommend installing an IDE for this project. We used IntelliJ.
- Install Docker and set it up as per your operating system.
- Docker Installation Guide Windows, Linux, Mac.
- After installing Docker, ensure it is running. Then, navigate to your project directory and run the command
docker compose up
in the terminal. If you encounter any errors, check thedocker-compose.yml
file in the project directory for conflicting port usage. - We recommend installing Postman for testing api calls.
- Now, finally run the
CarRentalBackendApplication
present in your project directory to start the project.
- Branch
- Customer
- Employee
- Rental
- Vehicle
- Vehicle Status
- Vehicle Type
- Branch Id
- Branch Location
- Branch Phone Number
- Branch Email
- Branch Manager
- Customer Id
- Customer Name
- Customer Driving License Number
- Customer Phone Number
- Customer Email
- Customer Address
- Employee Id
- Employee Name
- Employee Phone Number
- Employee email
- Employee Joining Date
- Employee Current Branch
- Rental Id
- Rental Vehicle
- Rental Customer
- Rental Start Date
- Rental End Date
- Rental Total Cost
- Vehicle Id
- Vehicle Manufacturer
- Vehicle Model
- Vehicle Registration Year
- Vehicle Number Plate
- Vehicle Mileage
- Branch to which Vehicle belongs
- Vehicle Type
- Vehicle Status
Spring Boot MySQL Docker Postman IntelliJ IDEA
- Status of the vehicle, such as whether it is AVAILABLE, already RENTED, or out for MAINTENANCE.
- Type of the vehicle, indicating whether it is a 2-wheeler or 4-wheeler.
- Architecture: RESTful API architecture using Spring Boot
- Database: MySQL Database
- /branch/{id} (GET): Retrieve a branch by its ID.
- /branch (GET): Retrieve all branches.
- /branch (POST): Create a new branch.
- /branch (PUT): Update an existing branch.
- /branch/{id} (DELETE): Delete a branch by its ID.
- /customers/{id} (GET): Retrieve a customer by their ID.
- /customers (GET): Retrieve all customers.
- /customers (POST): Add a new customer.
- /customers (PUT): Update an existing customer.
- /customers/{id} (DELETE): Delete a customer by their ID.
- /employee/{id} (GET): Retrieve an employee by their ID.
- /employee (GET): Retrieve all employees.
- /employee (POST): Create a new employee.
- /employee (PUT): Update an existing employee.
- /employee/{id} (DELETE): Delete an employee by their ID.
- /employee/branch/{id} (GET): Retrieve all employees of a specific branch.
- /rental (POST): Create a new rental transaction.
- /rental/{id} (GET): Retrieve a rental transaction by its ID.
- /rental (GET): Retrieve all ongoing rentals.
- /rental/history/customer/{id} (GET): Retrieve rental history for a customer by their ID.
- /rental/history/vehicle/{id} (GET): Retrieve rental history for a vehicle by its ID.
- /rental/reservation/vehicle/{id} (GET): Retrieve reservations for a vehicle by its ID.
- /rental/reservation/customer/{id} (GET): Retrieve reservations for a customer by their ID.
- /rental/cost (GET): Calculate the rental cost based on provided parameters.
- /rental/{id} (DELETE): Cancel a rental transaction by its ID.
- /vehicles/{id} (GET): Retrieve a vehicle by its ID.
- /vehicles (GET): Retrieve all vehicles.
- /vehicles (POST): Create a new vehicle.
- /vehicles/{id} (PUT): Update an existing vehicle by its ID.
- /vehicles/{id} (DELETE): Remove a vehicle by its ID.
- /vehicles/type (GET): Retrieve vehicles by type.
- /vehicles/branch/{id} (GET): Retrieve vehicles by branch.
- /vehicles/status (GET): Retrieve vehicles by status.
-
/branch/{id} (GET)
Input: An ID of an existing branch, for example
1
.Output: A
BranchDto
object with the details of the branch with the given ID. For example:{ "id": 1, "location": "New York", "managerId": 1, "phoneNumber": "1234567890", "email": "branch.newyork@example.com" }
-
/branch (GET)
Input: No input is required.
Output: A list of
BranchDto
objects with the details of all branches. For example:[ { "id": 1, "location": "New York", "managerId": 1, "phoneNumber": "1234567890", "email": "branch.newyork@example.com" }, { "id": 2, "location": "Los Angeles", "managerId": 2, "phoneNumber": "0987654321", "email": "branch.losangeles@example.com" } ]
-
/employee (POST)
Input: A
Branch
object without an ID. For example:{ "location": "New York", "managerId": 1, "phoneNumber": "1234567890", "email": "branch.newyork@example.com" }
Output: A
BranchDto
object with the details of the created branch, including the generated ID. For example:{ "id": 1, "location": "New York", "managerId": 1, "phoneNumber": "1234567890", "email": "branch.newyork@example.com" }
-
/branch (PUT)
Input: A
Branch
object with an ID. For example:{ "id": 1, "location": "New York", "managerId": 1, "phoneNumber": "1234567890", "email": "branch.newyork@example.com" }
Output: A
BranchDto
object with the details of the updated branch. For example:{ "id": 1, "location": "New York", "managerId": 1, "phoneNumber": "1234567890", "email": "branch.newyork@example.com" }
-
/branch/{id} (DELETE)
Input: An ID of an existing branch, for example
1
.Output: A
BranchDto
object with the details of the deleted branch. For example:{ "id": 1, "location": "New York", "managerId": 1, "phoneNumber": "1234567890", "email": "branch.newyork@example.com" }
-
/employee/{id} (GET)
Input: An ID of an existing employee, for example
1
.Output: An
EmployeeDto
object with the details of the employee with the given ID. For example:{ "id": 1, "name": "John Doe", "phoneNumber": "1234567890", "email": "john.doe@example.com", "joiningDate": "2022-01-01", "branchId": 1 }
-
/employee (GET)
Input: No input is required.
Output: A list of
EmployeeDto
objects with the details of all employees. For example:[ { "id": 1, "name": "John Doe", "phoneNumber": "1234567890", "email": "john.doe@example.com", "joiningDate": "2022-01-01", "branchId": 1 }, { "id": 2, "name": "Jane Doe", "phoneNumber": "0987654321", "email": "jane.doe@example.com", "joiningDate": "2022-02-01", "branchId": 2 } ]
-
/employee (POST)
Input: An
Employee
object without an ID. For example:{ "name": "John Doe", "phoneNumber": "1234567890", "email": "john.doe@example.com", "joiningDate": "2022-01-01", "branch": { "id": 1 } }
Output: An
EmployeeDto
object with the details of the created employee, including the generated ID. For example:{ "id": 1, "name": "John Doe", "phoneNumber": "1234567890", "email": "john.doe@example.com", "joiningDate": "2022-01-01", "branchId": 1 }
-
/employee (PUT)
Input: An
Employee
object with an ID. For example:{ "id": 1, "name": "John Doe", "phoneNumber": "1234567890", "email": "john.doe@example.com", "joiningDate": "2022-01-01", "branch": { "id": 1 } }
Output: An
EmployeeDto
object with the details of the updated employee. For example:{ "id": 1, "name": "John Doe", "phoneNumber": "1234567890", "email": "john.doe@example.com", "joiningDate": "2022-01-01", "branchId": 1 }
-
/employee/{id} (DELETE)
Input: An ID of an existing employee, for example
1
.Output: An
EmployeeDto
object with the details of the deleted employee. For example:{ "id": 1, "name": "John Doe", "phoneNumber": "1234567890", "email": "john.doe@example.com", "joiningDate": "2022-01-01", "branchId": 1 }
-
getEmployeesByBranch(Long branchId)
Input: An ID of an existing branch, for example
1
.Output: A list of
EmployeeDto
objects with the details of all employees in the given branch. For example:[ { "id": 1, "name": "John Doe", "phoneNumber": "1234567890", "email": "john.doe@example.com", "joiningDate": "2022-01-01", "branchId": 1 }, { "id": 2, "name": "Jane Doe", "phoneNumber": "0987654321", "email": "jane.doe@example.com", "joiningDate": "2022-02-01", "branchId": 1 } ]
-
/rental (POST)
Input: A
RentalDto
object without an ID. For example:{ "customerId": 1, "vehicleId": 1, "startDate": "2022-01-01", "endDate": "2022-01-10" }
Output: A
Rental
object with the details of the created rental, including the generated ID. For example:{ "id": 1, "customerId": 1, "vehicleId": 1, "startDate": "2022-01-01", "endDate": "2022-01-10" }
-
/rental/{id} (GET)
Input: An ID of an existing rental, for example
1
.Output: A
Rental
object with the details of the rental with the given ID. For example:{ "id": 1, "customerId": 1, "vehicleId": 1, "startDate": "2022-01-01", "endDate": "2022-01-10" }
-
/rental (GET)
Input: No input is required.
Output: A list of
Rental
objects with the details of all ongoing rentals. -
/rental/history/customer/{id} (GET)
Input: An ID of an existing customer, for example
1
.Output: A list of
Rental
objects with the details of all rentals by the given customer. -
/rental/history/vehicle/{id} (GET)
Input: An ID of an existing vehicle, for example
1
.Output: A list of
Rental
objects with the details of all rentals of the given vehicle. -
/rental/reservation/vehicle/{id} (GET)
Input: An ID of an existing vehicle, for example
1
.Output: A list of
Rental
objects with the details of all reservations of the given vehicle. -
/rental/reservation/customer/{id} (GET)
Input: An ID of an existing customer, for example
1
.Output: A list of
Rental
objects with the details of all reservations by the given customer. -
/rental/cost (GET)
Input: A
CostDto
object with the details of the rental for which the cost is to be calculated. For example:{ "vehicleId": 1, "startDate": "2022-01-01", "endDate": "2022-01-10" }
Output: The cost of the rental as a
Double
. -
/rental/{id} (DELETE)
Input: An ID of an existing rental, for example
1
.Output: A
Rental
object with the details of the cancelled rental. -
/vehicles/{id}
Input: An ID of an existing vehicle, for example
1
.Output: A
VehicleDto
object with the details of the vehicle with the given ID. For example:{ "id": 1, "manufacturer": "Toyota", "model": "Camry", "year": 2018, "licensePlateNumber": "ABC-123", "currentMileage": 50000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "AVAILABLE", "branchId": 1 }
-
/vehicles (GET)
Input: No input is required.
Output: A list of
VehicleDto
objects with the details of all vehicles. For example:[ { "id": 1, "manufacturer": "Toyota", "model": "Camry", "year": 2018, "licensePlateNumber": "ABC-123", "currentMileage": 50000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "AVAILABLE", "branchId": 1 }, { "id": 2, "manufacturer": "Honda", "model": "Civic", "year": 2019, "licensePlateNumber": "XYZ-456", "currentMileage": 40000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "RENTED", "branchId": 2 } ]
-
/vehicles (POST)
Input: A
VehicleDto
object without an ID. For example:{ "manufacturer": "Toyota", "model": "Camry", "year": 2018, "licensePlateNumber": "ABC-123", "currentMileage": 50000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "AVAILABLE", "branchId": 1 }
Output: A
VehicleDto
object with the details of the created vehicle, including the generated ID. For example:{ "id": 1, "manufacturer": "Toyota", "model": "Camry", "year": 2018, "licensePlateNumber": "ABC-123", "currentMileage": 50000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "AVAILABLE", "branchId": 1 }
-
/vehicles/{id} (PUT)
Input: A
VehicleDto
object with an ID. For example:{ "id": 1, "manufacturer": "Toyota", "model": "Camry", "year": 2018, "licensePlateNumber": "ABC-123", "currentMileage": 50000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "AVAILABLE", "branchId": 1 }
Output: A
VehicleDto
object with the details of the updated vehicle. For example:{ "id": 1, "manufacturer": "Toyota", "model": "Camry", "year": 2018, "licensePlateNumber": "ABC-123", "currentMileage": 50000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "AVAILABLE", "branchId": 1 }
-
/vehicles/{id} (DELETE)
Input: An ID of an existing vehicle, for example
1
.Output: A
VehicleDto
object with the details of the deleted vehicle. For example:{ "id": 1, "manufacturer": "Toyota", "model": "Camry", "year": 2018, "licensePlateNumber": "ABC-123", "currentMileage": 50000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "AVAILABLE", "branchId": 1 }
-
/vehicles/type (GET)
Input: An ID of an existing branch, for example
1
.Output: A list of
VehicleDto
objects with the details of all vehicles in the given branch. For example:[ { "id": 1, "manufacturer": "Toyota", "model": "Camry", "year": 2018, "licensePlateNumber": "ABC-123", "currentMileage": 50000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "AVAILABLE", "branchId": 1 }, { "id": 2, "manufacturer": "Honda", "model": "Civic", "year": 2019, "licensePlateNumber": "XYZ-456", "currentMileage": 40000.0, "vehicleType": "FOUR_WHEELER", "vehicleStatus": "RENTED", "branchId": 1 } ]