Welcome to the Book Rental Application! This application allows users to manage books, authors, and rentals.
To set up and run the application locally, follow these steps:
-
Clone the Repository: Clone the repository to your local machine using the following command:
git clone https://github.com/imamarham10/BookRentalApplication.git
-
Navigate to the Project Directory: Change to the project directory:
cd BookRentalApplication
-
Install Dependencies: Install the necessary dependencies using Maven:
mvn clean install
-
Configure Database: Configure your database settings in the
application.properties
file located in thesrc/main/resources
directory. -
Run the Application: Run the application using Maven:
mvn spring-boot:run
-
Access the Application: Access the application by navigating to
http://localhost:8080
in your web browser.
- Get All Books:
GET /api/books/
- Get Book by ID:
GET /api/books/by-id?id={id}
- Get Book by Author Name:
GET /api/books/by-author?name={name}
- Get Book currently rented:
GET /api/books/currently-rented
- Get Book available for rent:
GET /api/books/available-for-rent
- Add Book:
POST /api/books/{id}
- Request Body:
{ "title": "Sample Book", "isbn": "1234567890", "publicationYear": 2022 }
- Request Body:
- Update Book:
PUT /api/books/{id}?author_id={id}
- Request Body:
{ "title": "Sample Book 2", "isbn": "978-3-16-148410-2", "publicationYear": 2021, "availableForRent": true }
- Request Body:
- Delete Book:
DELETE /api/books/{id}
- Get All Authors:
GET /api/author/
- Get Author by ID:
GET /api/author/by-id?author_id={id}
- Add Author:
POST /api/author
- Request Body:
{ "name": "John Doe", "biography": "Test Author Biography" }
- Request Body:
- Update Author:
PUT /api/author?author_id={id}
- Request Body:
{ "name": "Updated Author Name", "biography": "Updated Author Biography" }
- Request Body:
- Delete Author:
DELETE /api/author?author_id={id}
- Get All Rentals:
GET /api/rentals/
- Get Rental by Renter Name:
GET /api/rentals/by-renterName?name={name}
- Get Overdue Rentals:
GET /api/rentals/overdue-rentals
- Add Rental using Book Id:
POST /api/rentals?book_id={id}
- Request Body:
{ "renterName": "John", "rentalDate": "2024-03-30", "returnDate": null }
- Request Body:
- Update Rental:
PUT /api/rentals?rental_id={id}
- Request Body:
{ "returnDate": "2024-04-23" }
- Request Body:
- Delete Rental:
DELETE /api/rentals?rental_id={id}