Run the application from:
LibraryApplication.java
After starting the project, access the API documentation here:
http://localhost:8080/swagger-ui/index.html
Access the embedded database at:
http://localhost:8080/h2-console
JDBC URL:
jdbc:h2:file:./data/library_database
GET http://localhost:8080/users
GET http://localhost:8080/books
GET http://localhost:8080/reservations
GET http://localhost:8080/users/20
(Triggers exception since user ID 20 does not exist)
POST http://localhost:8080/books
{
"title": "DotinProject",
"author": "Maryam",
"available": true,
"pages": 635,
"user": null
}POST http://localhost:8080/users/13/reserve-book?bookName=DotinProject
Reservations are automatically synced with Google Calendar.
Download and add the Google Calendar API JAR:
- 3-Tier Architecture
- RESTful API with Spring Boot
- Dependency Injection
- JPA + Entity Manager
- H2 Database
- MongoDB Integration
- Swagger UI Documentation
- Logging with SLF4J
- AOP-based Logging
- Custom Exceptions
- Validation
- Unit Testing
- Security (Authentication & Authorization)
- Google Calendar API Integration
- Interactive Terminal UI
- In-memory ArrayList database (legacy layer)
This version provides a CLI-based interface after login and authorization.
Users are shown role-based menus:
- User
- Admin
- Manager
Each role has specific permissions and actions. The system exits after task completion or user selection.
Passwords are never stored in plain text. Instead:
- Each user gets a unique cryptographic salt
- Passwords are hashed using SHA-256 + salt
- Only hashed values are stored in the database
- User enters username and password
- System retrieves stored salt + hash
- Input password is hashed with stored salt
- Hashes are compared
- Match → Login successful
- No match → Access denied
-
showAvailableBooks()
Displays all books available for reservation. -
reservationRequest(Scanner in)
Requests a book reservation. -
pendingReserveBooks()
Shows pending reservation requests. -
deleteReserveRequest(Scanner in)
Cancels a pending reservation. -
showReservedBooks()
Displays approved reservations. -
getBookNameFromUser(Scanner in)
Helper method for input handling. -
showFilteredBooks(String stat)
Internal helper for filtering reservations. -
showMenu(Scanner in)
Main user menu navigation.
The Admin class extends User and provides system management features:
addBook()→ Add new booksremoveBook()→ Delete books by IDshowMenu(Scanner in)→ Admin dashboard menurunFuncForCommand(int choice, Scanner in)→ Executes admin actions
