This is a Java project that implements the basic functionality of an electronic library.
- Java 17
- Spring Boot 3.1.2
- Spring Boot Starter Data JPA
- Spring Boot Starter Thymeleaf
- Spring Boot Starter Validation
- Spring Boot Starter Web
- Spring Boot Starter Test
- PostgreSQL
- Thymeleaf
- Maven
-
View all books:
- Route:
GET /books
- Description: Displays a list of all books with optional pagination and sorting by year.
- Route:
-
View a specific book:
- Route:
GET /books/{book_id}
- Description: Displays information about a specific book, its owner, and all users.
- Route:
-
Add a new book:
- Route:
GET /books/new
- Description: Displays a form for adding a new book.
- Route:
POST /books
- Description: Processes the form submission and saves the new book.
- Route:
-
Edit a book:
- Route:
GET /books/{book_id}/edit
- Description: Displays a form for editing book information.
- Route:
PATCH /books/{book_id}
- Description: Processes the form submission and updates the book information.
- Route:
-
Delete a book:
- Route:
DELETE /books/{id}
- Description: Deletes a book.
- Route:
-
Release a book (remove owner):
- Route:
PATCH /books/{book_id}/free
- Description: Removes the owner of the book.
- Route:
-
Assign an owner to a book:
- Route:
PATCH /books/{book_id}/assign
- Description: Assigns an owner to the book.
- Route:
-
Search for books:
- Route:
GET /books/search
- Description: Displays the book search page.
- Route:
POST /books/search
- Description: Performs a search for books by name and displays the results.
- Route:
-
Create test data:
- Route:
POST /books/createTests
- Description: Creates test data for books.
- Route:
-
View all users:
- Route:
GET /people
- Description: Displays a list of all users.
- Route:
-
View a specific user:
- Route:
GET /people/{person_id}
- Description: Displays information about a specific user and all books owned by them.
- Route:
-
Add a new user:
- Route:
GET /people/new
- Description: Displays a form for adding a new user.
- Route:
POST /people
- Description: Processes the form submission and saves the new user.
- Route:
-
Edit a user:
- Route:
GET /people/{id}/edit
- Description: Displays a form for editing user information.
- Route:
PATCH /people/{id}
- Description: Processes the form submission and updates the user information.
- Route:
-
Delete a user:
- Route:
DELETE /people/{id}
- Description: Deletes a user.
- Route:
-
Clone the repository:
git clone https://github.com/yourusername/yourrepository.git cd yourrepository
-
Configure the database:
- Ensure PostgreSQL is installed and running.
- Create a database for the project.
- Update the database configuration in
application.properties
.
-
Build the project:
mvn clean install
-
Run the project:
mvn spring-boot:run
- Access the application in your browser at
http://localhost:8080
. - Use the provided routes to manage books and users.