Skip to content

Latest commit

 

History

History
132 lines (92 loc) · 3.21 KB

File metadata and controls

132 lines (92 loc) · 3.21 KB

Library-Management-System-SpringBoot

This project aims to develop a robust Library Management System API using Spring Boot. The system facilitates librarians in efficiently managing books, patrons, and borrowing records.

Features

  • Manage books, patrons, and borrowing records
  • RESTful API endpoints
  • CRUD operations
  • Validation and error handling
  • Unit tests

Tech Used

  • Java
  • Spring Boot
  • Spring Data JPA
  • MySQL
  • Log4j2

How to Run the Application

Prerequisites

Ensure you have the following installed:

  • Java Development Kit (JDK) 17
  • Maven
  • MySQL

Setup

  1. Clone the Repository: https://github.com/OmarHariry/Library-Management-System-SpringBoot
  2. Configure the Database: CREATE DATABASE library_db;
  3. Build the Project: mvn clean install
  4. Run the Application: mvn spring-boot:run

Interact with API Endpoints

You can use tools like curl, Postman, or any other API client to interact with the endpoints.

Book Endpoints

- Get all books:

GET /api/books

Response:

image

- Get a book by ID:

GET /api/books/{id} Response:

image

- Add a new book:

POST /api/books/add

Request Body:

image

Response:

image

- Edit a existing book:

PUT /api/books/edit/{id}

Request Body:

image

Response:

image

- Delete a book:

DELETE /api/books/delete/{id}

Response:

image


Patron Endpoints

- Get all patrons:

GET /api/patrons

Response:

image

- Get a patron by ID:

GET /api/patron/{id} Response:

image

- Add a new patron:

POST /api/patron/add

Request Body:

image

Response:

image

- Edit a existing patron:

PUT /api/patron/edit/{id} Request Body:

image

Response:

image

- Delete a patron:

DELETE /api/patron/delete/{id}

Response:

image

Borrowing Record Endpoints

- Borrow a book:

POST api/borrow/{bookId}/patron/{patronId}

Response:

image

- Return a book:

PUT api/return/{bookId}/patron/{patronId}

Response:

image