Skip to content

Bookstore API allows adding books alongside with authors and publishers

Notifications You must be signed in to change notification settings

eliseusalomao/bookstore-api

Repository files navigation

Bookstore 📚

An API that allows adding books along with one or more authors and publisher information. It also enables creating reviews for books.

Purpose

To reinforce my knowledge about Java Spring Boot and Spring Data JPA.

My focus was to reinforce:

  • How LAZY and EAGER Fetch work;
  • What the @Transactional does;
  • How the relationships are established;

How to run this project

  1. Setup Docker
    Run docker compose up -d on project directory.

  2. Run the Spring Boot Application

  3. Populate database

   insert into publishers values(gen_random_uuid(), 'Alta Books');
   insert into publishers values(gen_random_uuid(), 'Pearson');

   insert into authors values(gen_random_uuid(), 'Eric Evans');
   insert into authors values(gen_random_uuid(), 'Paul Deitel');
   insert into authors values(gen_random_uuid(), 'Harvey Deitel');

API Endpoints

POST BOOK

   POST /bookstore/books
   {
   	"title": "Java: Como programar",
   	"publisherId": "79e1f32b-f6ab-43bc-b894-3d657d4e2491",
   	"authorIds": ["59fe8dd4-eab3-41f2-9d21-46682c84503b", "9f9e5d8f-0333-4598-8fcd-9b1160f05c2a"],
   	"reviewComment": "Adorei ler este livro, pois é um grande compilado de ensinamentos!"
   }

GET BOOK

    GET /bookstore/books

DELETE BOOK

   DELETE /bookstore/books/5c6769be-dbd7-4f08-aa4b-707d47534fd7

Database

This project uses a PostgreSQL database; you can use the database client of your choice.

About

Bookstore API allows adding books alongside with authors and publishers

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages