Skip to content

tgoldenphoenix/ShoppingCart-SpringBoot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce API Spring Boot Hibernate & MySQL

ERD

ERD Diagram

Technologies

mySQL, Spring Boot, Spring data JPA

Constructor injection of service classes via their Interface

DTO classes, custom request/response classes

normalize api response with a custom class ApiResponse

Try ModelMapper instead of MapStruct

Product

One product can have many images. Store image as blob. Have urls to download images.

API to search product from DB based on different queries:

  • Get product by id using @PathVariable
  • Get products by category, by brand using @RequestParam
  • Get products by category AND brand,

Add product: If category not yet exist, create new category then add product to that category

Return product dto with image dto including image link and name

Create AddProductRequest & ProductUpdateRequest objects

Product Image

  • save & update image
  • delete image
  • get all image of a product

image is saved inside MySQL using blob data type

Category

Basic crud apis

Cart & Cart Item

Each user can only have one cart. Cart information is stored inside Database to persist after user had log-out.

User can add [quantity] of an available item to their cart

One cart has multiple CartItem. Each CartItem is a Product

Notes

  • @RequestParam?brand=apple; case in-sensitive, Apple hay apple both ok;
  • @PathVariableproduct/{productId}
  • RequestBody là raw json inside body

References

video instruction

About

An E-Commerce API build in Spring Boot Hibernate and 10 MySQL realtional tables

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages