This repository contains a REST API developed for an e-commerce application. The API supports fundamental CRUD operations required by any e-commerce platform, with user authentication and 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
- Authentication & Validation:
- Both Customer and Seller are authenticated using a session token that is valid for 1 hour to ensure secure transactions.
- Administrator Role: The seller has administrative control over the application.
- Product Management: Only registered sellers with a valid session token can add, update, or delete products in the main database.
- Order Management: Sellers can access details of various customers and their orders.
- Registration and Login: Customers can register on the application and log in to receive a valid session token.
- Product Browsing: Customers can view different products, add them to their cart, and place orders.
- Personalized Access: Logged-in customers can access their orders, cart, and other features.
- Clone the repository:
git clone https://github.com/subhashchandra-birajdar/ecommerce-app.git cd ecommerce-app
https://localhost:9000/
http://localhost:9000/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:9000/login/customer
- Request Body
{
"mobileId": "9999999999",
"password": "shyam123456"
}
- Response
{
"sessionId": 23,
"token": "customer_0ad57094",
"userId": 19,
"userType": "customer",
"sessionStartTime": "2022-06-10T10:48:20.0109626",
"sessionEndTime": "2022-06-10T11:48:20.0109626"
}
