Skip to content

pavel-kuropatin/Library-SpringMVC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library (powered by Spring WEB MVC)

Project description

This is a library that allows to perform CRUD operations with books and their authors. It was created as part of an interview test task at Godel Technologies. Main goals of this task are described in Mogilev Mastery 2021 Task.pdf located in the project root.

Application features

  1. Ability to create books that contain following information: book name, year of publication, authors, publisher.
  2. A book can have one or more authors. The book must have at least one author on creation/editing.
  3. Ability to edit the authors of the book.
  4. Ability to create authors that contain following information: first name, last name, date of birth, sex.
  5. If author was born later than the book was published, then he is not shown in the list of authors to be added as book author.
  6. The author can have any number of books under his own authorship, including 0.
  7. When an author is deleted, all books written by him are also deleted.
  8. Ability to get/add/edit/delete the Book and the Author including adding and removing the author of the book.
  9. Validation upon add/edit operation.
  10. The application provides the ability to search criteria for books (including their combinations):
    • by name (including the first letters);
    • by year of publication (in range);
    • by the name of the publisher (including the first letters);
    • by the first name / last name of the author (including the first letters);
    • by sex;
    • by year of birth (in range).
  11. Application contains an SQL script to initialize predefined data on application startup.

Technology stack

  • Java
  • Maven
  • Spring Web MVC
  • Spring JDBC
  • Thymeleaf
  • PostgreSQL
  • Git
  • SonarCloud via GitHub Actions

Known issues

  1. Date of birth stored as string. Must be stored and processed as SQL Data.

TODO

  1. Fix known issues.
  2. Add tests.
  3. Add multiple selection of authors on book creation and adding/removing authors to book.
  4. Wrap service methods bodies with try/catch and send exceptions information to the logger.
  5. Add admin/user functionality.
  6. Visually improve web forms.

Launch instructions

To launch this project you will need

  • IntellijIDEA CE or EE
  • JDK 11
  • Apache Maven 3.6.3 or higher
  • Apache Tomcat 9.0.41 or higher
  • PostgreSQL 13.1 or higher

How to

  1. Download project from github or clone using commands

    git clone https://github.com/Pavel-Kuropatin/GodelTestTask.git
    cd GodelTestTask
    
  2. Create a database with a name library, create user with a name username and password password. You can also use different database name and user. To do so, you must specify desired parameters in SpringConfig.java in this method:

    public DataSource dataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("org.postgresql.Driver");
        dataSource.setUrl("jdbc:postgresql://localhost:5432/library);
        dataSource.setUsername("username");
        dataSource.setPassword("password");
        return dataSource;
    }
  3. If you're using IntellijIDEA Community Edition you should go to File -> Settings -> Plugins and install Smart Tomcat plugin

    Smart Tomcat Plugin

  4. Press Alt+Shift+F10 then 0 to open Run/Debug Configuration then press Alt+Insert select Smart Tomcat and configure Run/Debug Configuration as follows. Make sure that Context Path field is empty. Deployment directory root may be different.
    In Before Launch tab press + and add Run Maven Goal task with empty command line. That allows maven to use default goal specified in pom.xml

    Create Run-Debug Configuration

    Select Maven Goal

  5. IntellijIDEA Enterprise Edition has inbuilt Tomcat Server, so you need to select Tomcat Server -> Local as Run/Debug Configuration and configure it same as above. In addition, you should press the Fix button and select Library-SpringMVC:war exploded. Application Context field must be empty

  6. If you did everything right, you can see start page at http://localhost:8080/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published