This API is designed to manage a digital library, allowing users to borrow books from the library, rate them, connect with readers who share similar interests, and return books to the library. The system implements custom data structures including graphs, binary search trees, and priority queues to efficiently manage library operations.
- User registration and authentication with role-based access (Reader/Administrator)
- Network of reader affinities based on similar book ratings
- Friend recommendations based on shared interests
- Complete book catalog
- Average book ratings
- Admin tools for adding, updating, and removing books
- Book borrowing and return processes
- Waitlist management using queues
- Loan history
- Book availability status updates
- Book rating (1-5 stars) and review functionality
- Calculation of average book ratings
- Analytics for most rated and highest-rated books
- Reader connectivity based on similar ratings
- Framework: Spring Boot
- Database: MongoDB
- Authentication: JWT-based authentication
- API: RESTful
- Binary Search Tree (BST): For efficient book catalog management
- Graph: For representing reader affinity networks
- Queue: For managing book waitlists
- Linked Lists: For tracking loan history and ratings
- Custom Array: For store some data returned from the DataBase
POST /api/users/register- Register a new userPOST /api/users/login- Authenticate user and receive tokenGET /api/users/{id}- Get Data from a particular User
GET /api/books/- Get all booksGET /api/books/{id}- Get book by IDGET /api/books/title/{title}- Get book by TitleGET /api/books/search- Search books by criteriaPOST /api/books/- Add new book (admin)PUT /api/books/{id}- Update book information (admin)DELETE /api/books/{id}- Remove book from catalog (admin)
POST /api/loans/- Borrow a book (Create a Loan)PUT /api/loans/{id}/return- Return a bookGET /api/loans/{id}- Get loand by IDGET /api/loans/user/{userId}- Get user's loansGET /api/loans/user/{userId}/active- Get user's active loansGET /api/loans/queue/{bookId}- Get the waiting queue for a particular book
POST /api/ratings/- Rate a book (Create a Rating)GET /api/ratings/- Get all ratingsPUT /api/ratings/{id}- Update a ratingGET /api/ratings/{id}- Get rating by idGET /api/ratings/book/{id}- Get book ratingsGET /api/ratings/user/{id}- Get user ratings
POST /api/messages/- Send a messageGET /api/messages/{id}- Get message by idGET /api/messages/sender/{senderId}- Get message by SenderGET /api/messages/receiver/{receiverId}- Get message by Receiver
GET /api/stats/user-loans/{userId}- Get User loan statisticsGET /api/stats/path/{userId1}/{userId2}- Get the shortest path between usersGET /api/stats/most-rated-books- Get most rated booksGET /api/stats/readers-with-most-friends- Get users with more connections
-
Clone the repository
git clone https://github.com/ecodant/gotabook-backend.git
-
Configure MongoDB connection in
.envwith the correct attributes, use the.env.modelas a reference -
Build the backend
mvn clean install
-
Run the application