Skip to content

A Spring Boot bookstore inventory system that can be accessed vis console or through APIs.

Notifications You must be signed in to change notification settings

mariammahmoud18/Bookstore-Inventory-System

Repository files navigation

Bookstore-Inventory-System

The Bookstore Inventory System is a console-based application built using Spring Boot 3.5 and Java 23. It is designed to manage inventory for a bookstore, allowing users to perform CRUD operations on three main entities: Publisher, Book, and Author. The system provides a variety of functionalities to manage relationships between these entities, such as adding books to publishers, authors to books, and more.


Features

Publisher Management

  • Create Publisher: Add a new publisher to the system.
  • Find Publisher by ID: Retrieve a publisher by its unique ID.
  • Find Publisher by Name: Search for a publisher by name.
  • Delete Publisher: Remove a publisher from the system.
  • Update Publisher: Modify details of an existing publisher.
  • Add Book to Publisher: Associate a book with a publisher.
  • Get Publisher Books: Retrieve all books associated with a specific publisher.
  • Get All Publishers: List all publishers in the system.

Author Management

  • Create Author: Add a new author to the system.
  • Find Author by ID: Retrieve an author by their unique ID.
  • Find Author by First Name: Search for authors by their first name.
  • Find Author by Last Name: Search for authors by their last name.
  • Find Author by Nationality: Search for authors by nationality.
  • Delete Author: Remove an author from the system.
  • Update Author: Modify details of an existing author.
  • Get Author Books: Retrieve all books written by a specific author.
  • Add Author to Book: Associate an author with a book.

Book Management

  • Create Book: Add a new book to the system.
  • Find Book by ID: Retrieve a book by its unique ID.
  • Find Book by Title: Search for books by title.
  • Find Book by Author: Retrieve books written by a specific author.
  • Find Book by Year Published: Search for books by their publication year.
  • Find Book by Genre: Retrieve books by genre.
  • Find Book by Publisher: Retrieve books associated with a specific publisher.
  • Delete Book: Remove a book from the system.
  • Update Book: Modify details of an existing book.
  • Get Book Stock: Check the stock availability of a book.
  • Get Book Price: Retrieve the price of a book.
  • Get Book Author/s: Retrieve the author(s) of a book.
  • Get Book Publisher: Retrieve the publisher of a book.
  • Add Author to Book: Associate an author with a book.
  • Add Publisher to Book: Associate a publisher with a book.

Technologies Used

  • Java 23: The core programming language used for the application.
  • Spring Boot: Framework for building the application and managing dependencies.
  • Hibernate: ORM (Object-Relational Mapping) for database interactions.
  • MySQL: Relational database used for storing and managing data.
  • Maven: Build automation and dependency management.

Entity Relationships

Publisher:

  • A publisher can have multiple books.
  • A book belongs to one publisher.

Author:

  • An author can write multiple books.
  • A book can have multiple authors.

Book:

  • A book is associated with one publisher and one or more authors.

Class Diagram

Bookstore Inventory System


Database Script

CREATE TABLE book (
  id int NOT NULL AUTO_INCREMENT,
  Title varchar(45) DEFAULT NULL,
  year_published year DEFAULT NULL,
  price integer DEFAULT NULL,
  stock integer DEFAULT NULL,
  genres VARCHAR(255) DEFAULT NULL,
  publisher_id integer,
  FOREIGN KEY (publisher_id) REFERENCES publisher(id) ON DELETE CASCADE,
  PRIMARY KEY (id)
); 

CREATE TABLE publisher (
  id int NOT NULL AUTO_INCREMENT,
  name varchar(45) DEFAULT NULL,
  address varchar(45) DEFAULT NULL,
  phone varchar(15) DEFAULT NULL,
  email varchar(45) DEFAULT NULL,
  PRIMARY KEY (id)
); 

CREATE TABLE author (
  id int NOT NULL AUTO_INCREMENT,
  first_name varchar(45) DEFAULT NULL,
  last_name varchar(45) DEFAULT NULL,
  bio varchar(255) DEFAULT NULL,
  nationality varchar(255) DEFAULT NULL,
  birthdate date DEFAULT NULL,
  PRIMARY KEY (id)
);

CREATE TABLE book_authors (
    book_id INT,
    author_id INT,
    PRIMARY KEY (book_id, author_id),
    FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE,
    FOREIGN KEY (author_id) REFERENCES authors(id) ON DELETE CASCADE
);

About

A Spring Boot bookstore inventory system that can be accessed vis console or through APIs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages