Skip to content

Latest commit

 

History

History
98 lines (66 loc) · 4.44 KB

File metadata and controls

98 lines (66 loc) · 4.44 KB

PA165 Library Management System

System to manage, reserve, and borrow books from library.

Library Management System aims to provide a platform for managing library resources and services. The system allows users to access the library's resources online, search for books, reserve books, borrow and return books, and manage their accounts. The system has two types of users: the librarian and the members. The librarian is responsible for managing the library resources, adding new books, updating book information and managing user accounts. The members can search for books, reserve books, borrow and return books, and manage their accounts. Each borrow has a price and a limit in days for returning, and if this limit is not kept, there is a configurable fine for each delayed day. Anonymous users can only list and search books, but cannot reserve or borrow books without having an account.

Installation

Build and run locally

cd <microservice-dir>
mvn package
java -jar target/<microservice-artifact>.jar [--spring.config.location=./config/application-external.yml]

Build images and run all services in container

# in root dir
# define .env
cat .env
podman-compose build
podman-compose up

Prometheus will be running at http://localhost:9090/. Grafana with preconfigured datasource and dashboard will be running at http://localhost:3000/.

Microservices

The Book Microservice is responsible for managing all information related to books within the library. It handles operations such as adding new books, updating book details, removing books, and searching the catalog. It supports search to easily find books by title and author.

The User Microservice is responsible for storing and managing user data, including personal information and assigned role -- librarian or member. It supports operations for creating, updating, and retrieving user profiles. It maintains the user identity and role data required by other services to enforce access control and permissions.

The Reservation Microservice handles the process of reserving books. It allows users to place reservations on available or currently borrowed books. It allows members to join a waitlist for a book, ensuring they get a turn once the book is returned.

The Borrowing Microservice handles borrowing and returning of books. It records when a user borrows a book, tracks the due date, and updates the system when the book is returned. Borrowing limits are handled by the Fine Microservice.

The Fine Microservice is responsible for calculating and tracking fines for overdue books. It applies configurable fine policies based on the number of delayed days and integrates with the Borrowing Microservice to monitor due dates. It also provides interfaces for users to view and pay fines.

Security

This project includes the authorization-service module, which provides a single REST API responsible for retrieving an access token for the authenticated user. This token can then be used to call REST APIs exposed by other microservices.

To obtain the token, you need to log in via the MUNI Unified Login Provider. Simply start the module and navigate to http://localhost:8080. You will be automatically redirected to the login page. After a successful login, the access token will be displayed on the screen.

Messaging

Apache Artemis serves as the message queue between BorrowingService and FineService. Each day, a scheduled task in BorrowingService identifies overdue borrowings and publishes them to the queue. FineService listens to the queue, consumes the messages, and updates its internal state accordingly.

Use-case diagram

Use case diagram

DTO class diagram

DTO class diagram

Showcase

Showcase includes a scenario where main functionalites of the library management system are being used regularly. Mostly the borrowing and reserving of books. This also shows the use of the system under load.

pip install locust
locust -f showcase.py -H 'http://localhost'
  • script expects a token file to be in the the project's root folder
  • token file should contain a token obtained from auhtorization service
  • all services have to be running