A Spring Boot-based REST API for managing loans and persons. The API allows users to create, retrieve, and delete loan records, as well as manage persons and associate loans with them.
- Loan Management: Create, retrieve, and delete loans.
- Person Management: Create, retrieve, and delete persons.
- Person Association: Associate loans with persons using their IDs.
- Model Mapping: Uses ModelMapper for DTO-to-entity and entity-to-DTO conversions.
- Error Handling: Custom exception handling for missing loans or persons.
- API Documentation: Integrated Swagger UI for API documentation and testing.
- Java: Core programming language.
- Spring Boot: Framework for building the REST API.
- Maven: Dependency management and build tool.
- ModelMapper: For object mapping between DTOs and entities.
- Lombok: To reduce boilerplate code (e.g., getters, setters).
- MongoDB: NoSQL database for storing loan and person data.
- Swagger: For API documentation and testing.
- GET /api/v1/loans/get/{id}: Retrieve a loan by its ID.
- POST /api/v1/loans/create: Create a new loan.
- DELETE /api/v1/loans/delete/{id}: Delete a loan by its ID.
- GET /api/v1/persons: Retrieve all persons.
- POST /api/v1/persons/create: Create a new person.
- DELETE /api/v1/persons/delete/{id}: Delete a person by their ID.
This project includes API documentation generated using Swagger. The documentation provides details about all available endpoints, request/response structures, and example payloads.
- Clone the repository.
- Navigate to the project directory.
- Run the application using:
mvn spring-boot:run
- Access the API at
http://localhost:8080/api/v1/. - Use tools like Postman or curl to test the endpoints.
- Ensure MongoDB is running and configured correctly in
application.properties.