Skip to content

Suresh-javadev/basic-ecommerce

Repository files navigation

basic-ecommerce

Rest api for basic ecommerce actions

List of Tech features used for this projects are:


  • Spring Boot
  • Spring Boot Data Jpa
  • H2 in memory DB
  • Spring Boot Validations
  • Swagger
  • Mapstruct
  • Basic Auth
  • Method Level Security
  • Central Exception Handler
  • Custom Validation Annotation Creations
  • Custom Method Security Expressions
  • JUnit Rest Api Test Case with Mockito

Action Available in project

  • One can create User(Role{ADMIN or USER})
  • Get User
  • Get User List
  • Delete User
  • Edit User
  • Create Product
  • Get Product
  • Get Product List
  • Delete Product

Default Users

admin admin@123
user user@123

Swagger

localhost:18080/swagger-ui.html

Api Sample Validation Error(400)

{
  "httpStatus": "BAD_REQUEST",
  "timestamp": "2022-04-10 11:55:06",
  "message": "Validation Error",
  "details": "{password=[Passdword must have min 8 char, max 50!], name=[Name must have min 4 char, max 100!], username=[Name must have min 4 char, max 50!]}"
}

Api Sample Unauthorized Access Error(403)

{
    "httpStatus": "FORBIDDEN",
    "timestamp": "2022-04-10 12:22:12",
    "message": "No Access",
    "details": "Access is denied"
}

User API

Product API



Order API



DB Diagram



Results: Test Cases - JUnit Test - MockMvc