- I have developed this REST API for an e-commerce application. This API performs all the fundamental CRUD operations of any e-commerce platform with user validation at every step.
 
- Java
 - Spring Framework
 - Spring Boot
 - Spring Data JPA
 - Hibernate
 - MySQL
 
- Login, Logout Module
 - Seller Module
 - Customer Module
 - Product Module
 - Cart Module
 - Order Module
 
- Customer and Seller authentication & validation with session token having validity of 1 hour for security purposes
 - Seller Features:
- Administrator Role of the entire application
 - Only registered seller with valid session token can add/update/delete products from main database
 - Seller can access the details of different customers, orders
 
 - Customer Features:
- Registering themselves with application, and logging in to get the valid session token
 - Viewing different products and adding them to cart and placing orders
 - Only logged in user can access his orders, cart and other features.
 
 
- Before running the API server, you should update the database config inside the application.properties file.
 - Update the port number, username and password as per your local database config.
 
    server.port=8080
    spring.datasource.url=jdbc:mysql://localhost:3306/ecommercedb
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
    spring.datasource.username=root
    spring.datasource.password=root
https://localhost:8080/
http://localhost:8080/swagger-ui/index.html#/
POST /register/customer: Register a new customerPOST /login/customer: Logging in customer with valid mobile number & passwordPOST /logout/customer: Logging out customer based on session tokenPOST /register/seller: Register a new sellerPOST /login/seller: Logging in SellerPOST /logout/seller: Logging out Seller based on session token
GET /customer/current: Getting currently logged in customerGET /customer/orders: Getting order history of logged in customerGET /customers: Getting All customersPUT /customer: Updates logged in customerPUT /customer/update/password: Updates customer passwordPUT /customer/update/card: Updates credit card detailsPUT /customer/update/address?type=home: Updates customer's home addressPUT /customer/update/credentials: Updates email address and mobile numberDELETE /customer: Deletes logged in user with valid session tokenDELETE /customer/delete/address?type=home: Deletes customer's home address
GET /seller/{sellerid}: Gets seller with passed seller IdGET /seller/current: Gets seller details for currently logged in sellerGET /sellers: Gets all sellersPOST /addseller: Adding new sellerPUT /seller: Updates seller detailsPUT /seller/update/password: Updates seller passwordPUT /seller/update/mobile: Updates seller mobile numberDELETE /seller/{sellerid}: Deletes seller with passed id
GET /product/{id}: Gets product with given product idGET /products: Gets all productsGET /products/{category}: Gets product with given categoryGET /products/seller/{id}: Gets product of given seller idPOST /products: Adds a new product to databasePUT /products: Updates the product with given product idPUT /products/{id}: Updates product quantityDELETE /product/{id}: Deletes product with given id
GET /cart: Get all items in Customer CartPOST /cart/add: Add item to CartDELETE /cart: Remove item from CartDELETE /cart/clear: Clear entire cart
GET /orders/{id}: Gets order details with given order idGET /orders: Gets all ordersGET /orders/by/date: Gets orders placed on given date (DD-MM-YYYY)POST /order/place: Places a new order based on cart itemsPUT /orders/{id}: Updates a pending orderDELETE /orders/{id}: Cancels an order
POST   localhost:8080/login/customer
- Request Body
 
    {
        "mobileId": "9999999999",
        "password": "abhi8080"
    }
- Response
 
    {
        "sessionId": 23,
        "token": "customer_0ad57094",
        "userId": 19,
        "userType": "customer",
        "sessionStartTime": "2022-06-10T10:48:20.0109626",
        "sessionEndTime": "2022-06-10T11:48:20.0109626"
    }
