Skip to content

Latest commit

 

History

55 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Management System

A comprehensive RESTful API for library management, providing robust functionality for book cataloging, user management, loan tracking, and library administration.

Features

  • Book Management: Add, update, delete, and search books with comprehensive metadata
  • Author Management: Track authors and their bibliographies
  • Publisher Management: Organize books by publishers
  • Category Management: Categorize books for easy browsing and filtering
  • Loan System: Track borrowing with automated due date calculations and returns
  • User Score System: Dynamic scoring based on loan history
  • Role-Based Access Control: Admin, staff, and member user types
  • JWT Authentication: Secure API access with token-based authentication
  • Dynamic Borrowing Rules: Customized borrowing limits based on user score

Technologies

  • Java 17
  • Spring Boot 3.x
  • Spring Security with JWT Authentication
  • Spring Data JPA & Hibernate
  • PostgreSQL Database
  • Maven
  • RESTful API Design
  • DTO Pattern & Custom Mappers
  • Global Exception Handling
  • Lombok

System Requirements

  • JDK 17+
  • Maven 3.6+
  • PostgreSQL 12+

Installation & Setup

  1. Clone the repository

    git clone https://github.com/ffozdemir/LibraryManagement.git
    cd LibraryManagement
  2. Configure database

    spring.datasource.url=jdbc:postgresql://localhost:5432/librarydb
    spring.datasource.username=postgres
    spring.datasource.password=yourpassword
    spring.jpa.hibernate.ddl-auto=update
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    spring.jpa.properties.hibernate.format_sql=true
  3. Build the project

    mvn clean install
  4. Run the application

    mvn spring-boot:run

API Endpoints

Authentication

  • POST /auth/login - User login
  • POST /auth/register - Register new user

Users

  • GET /user/users - List all users (Admin)
  • GET /user/users/{id} - Get user by ID
  • PUT /user/users/{id} - Update user
  • DELETE /user/users/{id} - Delete user
  • POST /user/users - Create new user
  • GET /user/user - Get current user information
  • GET /user/user/loans - Get loans for current user

Books

  • GET /book/books - List all books
  • GET /book/books/{id} - Get book by ID
  • POST /book/books - Create new book
  • PUT /book/books/{id} - Update book
  • DELETE /book/books/{id} - Delete book

Authors

  • GET /author/authors - List all authors
  • GET /author/authors/{id} - Get author by ID
  • POST /author/authors - Add new author
  • PUT /author/authors/{id} - Update author
  • DELETE /author/authors/{id} - Delete author

Publishers

  • GET /publisher/publishers - List all publishers
  • GET /publisher/publishers/{id} - Get publisher by ID
  • POST /publisher/publishers - Add new publisher
  • PUT /publisher/publishers/{id} - Update publisher
  • DELETE /publisher/publishers/{id} - Delete publisher

Categories

  • GET /category/categories - List all categories
  • GET /category/categories/{id} - Get category by ID
  • POST /category/categories - Add new category
  • PUT /category/categories/{id} - Update category
  • DELETE /category/categories/{id} - Delete category

Loans

  • GET /loan/loans - List all loans
  • GET /loan/loans/{id} - Get loan details
  • POST /loan/loans - Create new loan
  • PUT /loan/loans/{id} - Update loan (return book)
  • GET /loan/loans/user/{id} - Get loans by user ID
  • GET /loan/loans/book/{id} - Get loans by book ID
  • GET /loan/loans/auth/{id} - Get authenticated user's loans

Reports

  • GET /report/report - Get general report
  • GET /report/report/most-popular-books - Get most borrowed books
  • GET /report/report/most-borrowers - Get most active borrowers
  • GET /report/report/unreturned-books - Get currently unreturned books
  • GET /report/report/expired-books - Get overdue books

Role-Based Authorization

  • ADMIN: Full system access, user management, reports
  • STAFF: Book and loan management, limited user operations
  • MEMBER: Book browsing, own loan management

Dynamic Borrowing System

User score determines borrowing privileges:

  • Score < -1: 1 book for 3 days
  • Score < 0: 2 books for 6 days
  • Score < 1: 3 books for 10 days
  • Score < 2: 4 books for 15 days
  • Score >= 2: 5 books for 20 days

Project Structure

├── src/main/java/com/ffozdemir/librarymanagement
│   ├── config                 # Configuration classes
│   │   ├── OpenAPIConfig.java # Swagger configuration
│   │   └── WebSecurityConfig.java
│   ├── controller             # REST controllers
│   │   ├── business           # Book, Author, etc. controllers
│   │   └── user               # User-related controllers
│   ├── entity                 # Entity classes
│   │   ├── abstracts          # Base entity classes
│   │   ├── concretes          # Concrete entity implementations
│   │   └── enums              # Enumeration types
│   ├── exception              # Exception handling
│   │   ├── GlobalExceptionHandler.java
│   │   └── custom exceptions
│   ├── payload                # DTOs and mappers
│   │   ├── mappers            # Entity-DTO conversion
│   │   ├── messages           # Error messages
│   │   ├── request            # Request DTOs
│   │   └── response           # Response DTOs
│   ├── repository             # Data repositories
│   │   ├── business           # Business entities repositories
│   │   └── user               # User-related repositories
│   ├── security               # JWT and security config
│   ├── service                # Business logic
│   │   ├── business           # Book, Author services
│   │   ├── helper             # Helper services
│   │   └── user               # User-related services
│   └── LibrarymanagementApplication.java

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

Contact

For questions or feedback, please contact fetullahfurkanozdemir@gmail.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages