Skip to content

AlexSischin/librarykata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Kata

A library backend. It requires Java 25 and Postgres 16. Swagger is available at /swagger-ui/index.html.

Purpose

This project is made to test my coding skills. The assignment is the follows:

You can use any language you like; when in doubt choose the SIMPLEST option

I would like the following features in my library application

1. Add a new book to the catalog
2. A user can borrow a book
3. A user can return a book
4. Print a list of the books that I borrowed

Approach

It is trivial to formally complete the assignment. Therefore, I tried to make the solution as close to industry standards as possible, but keeping it simple at the same time. And as a Java backend developer, I focus on the Java corresponding part of the application.

Issues

My approach takes more time to complete than I expected, so I stopped the development being aware of some issues, including:

  • No createdAt, modifiedAt and deletedAt columns.
  • No code style validators.
  • Need much more tests to cover all cases.
  • All tests are in the same file.
  • Didn't test CORS config.
  • Custom exceptions should be used instead of generic ones like RuntimeException.
  • Almost no exception handling, e.g. ControllerAdvice.
  • Criteria API will be very convenient, if project becomes more complex.
  • Dto converters may be prone to LazyInitializationException, if project becomes more complex.
  • Project structure will become too crowded, if project becomes more complex.
  • No role model and admin functionality.

Environment variables

LIBRARYKATA_DB_HOST - postgres server host. Default: 127.0.0.1.

LIBRARYKATA_DB_PORT - postgres server port. Default: 5432.

LIBRARYKATA_DB_NAME - postgres database name.

LIBRARYKATA_DB_USER - postgres database user name.

LIBRARYKATA_DB_PASSWORD - postgres database user password.

JWT_SECRET_KEY - JWT secret key in Base 64 format.

JWT_EXPIRATION_TIME - JWT expiration period in ms.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages