Skip to content

This is a E-Commerce App which provide web service. This service can be used to generate REST API. User can sign in, sign up, search a product and buy it. Also with admin access, new product can be added and report can be generated to look upon sales.

Notifications You must be signed in to change notification settings

starving-array/E-Commerce-Rest-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce-Rest-API

Er Diagram

This is a springboot project which provide Web Service (REST API).

User can,

  1. Create a User account.
  2. Update your account details.
  3. Login to your account.
  4. Search a product by name
  5. Sort product by category, price, new, rating, feedback.
  6. Add a product to cart
  7. Order product from cart
  8. Order product directly without addinng to cart.
  9. Add feedbacks.
  10. Add ratings.

Admin can,

  1. Add new Catagory.
  2. Add new Product
  3. Add serviceable Postal code
  4. Add Payment method
  5. Get sales report => By Area, User, Catagory, City, State and more.
  6. Add debit/credit card and balance.

How to use?

As this is a rest API project, client part hasn't added to it. But you can use Swagger or Postman to play with the API. And also you can use this API with your frontend project. As it will be on localServer on your PC you need to keep the server on while playing with it. Steps given below for additional info,

1. CREATE database ecom;

Create a database on your local system. If you don't have MySQL installed, kindly install it first.

Once Installed please set/keep your mysql credentials as below

username: root
password: root

and create the database as mentioned above. Database name-> blogApp;

2. git clone https://github.com/starving-array/E-Commerce-Rest-API.git;

Clone this repo to your local system and open STS to import and run the project. If you don,t have STS IDE on your system, kindly download STS.

3. Open STS and Import the Project;

File -> Open Projects from File Systems -> Directory

  • Browse to the location where you have cloned this project. And select blog-api

Next-> Finish. It might take a few minutes to download all the dependencies on your local system. You can check the progress bar at righ-down corner.

Once finished update the Maven project to make sure all the dependencies have downloaded.

Right Click on blog_api at package exporer on leftside window, Maven -> Update Project -> check Force Update on SnapShots/releases -> Ok

Congratulation, you've successfully imported the project on your system

4. Start the Spring Boot App Server;

Right Click on blog_api at package exporer on leftside window, Run as -> Spring Boot App

You can see the process as a console window will be opening below.

5. http://localhost:8088/swagger-ui/;

Open this link on broswer. It will open the Swagger UI. You can play with All the API there.

6. STOP the server;

Once you are done with playing, click on the red square box on top of the console to stop the server.

Important Facts,

  1. The port for this application has set 8080. You can change it from Application Properties in resource folder, or stop any other running app before starting this as it can create conflict for same port that you might be using coincedently.

#changing the server port
server.port=8088

  1. _Incase if have different root name and password for mysql in your system, you change this application username and password from Application Properties.

# MySql username and Password
spring.datasource.username=root
spring.datasource.password=root

API names and Use=>

**UUID used as security param to authenticate user and maintain security.

1. User-controller:

  • createAccountH : Create a new account.
  • updateAccountH : Modify your account

1.1 Login-controller:
  • logInUser : Login with Contact No and Password. This will genarate a UUID to control activity and it will also maintain security.
  • logoutUser : Session will be deleted, (UUID) once you have logged out.
  • getAccountDetails : With UUID and account id as parameters, it will match if the user is same and return user detail.
  • logInAdmin : Login with admin login and Password. This will genarate a UUID to control admin activity in Admin controller and it will also maintain security.
Admin credential:

mobileNo=0000000000;
password=1234567890;

** For now this is the default credential of admin.

2. Rating-controller:

  • addRating : User can add rating to products.

3. Feedback-controller:

  • addFeedback : User can add feedbacks to products.
  • modifyFeedback : User can modify feedbacks.
  • viewMyFeedback : User can get all feedback made by them.
  • viewAllFeedback : User can get all feedback of the product.
  • deleteFeedback : User can delete own feedback of the product.

3.Product-Controller:

  • getProductById : Get a product by Product Id.
  • getProductsByName : Search products by name.
Product by sort:
  • categorySortByDateAsc : A category sorted by date asc.
  • categorySortByDateDesc : A category sorted by date desc.
  • sortByDateDesc : Sorted by date desc.
  • sortByDateAsc : Sorted by date asc.
  • categorySortByNameDesc : A category sorted by name desc.
  • categorySortByNameAsc : A category sorted by name asc.
  • sortByPriceDesc : Sorted by price desc.
  • sortByPriceAsc : Sorted by price asc.
  • categorySortByPriceDesc : A category sorted by price desc.
  • categorySortByPriceAsc : A category sorted by price asc.
  • sortByMaxMinPriceDesc : Sorted by max-min price desc.
  • sortByMaxMinPriceAsc : Sorted by max-min price asc.
  • CategorySortByMaxMinPriceDesc : A category sorted by max-min price desc.
  • CategorySortByMaxMinPriceAsc : A category sorted by max-min price asc.
  • sortByMinPriceDesc : Sorted by min price desc.
  • sortByMinPriceAsc : Sorted by min price asc
  • CategorySortByMinPriceDesc : A category sorted by min price desc.
  • CategorySortByMinPriceAsc : A category sorted by min price desc.
  • sortByMaxPriceDesc : Sorted by max price desc.
  • sortByMaxPriceAsc : Sorted by max price asc.
  • CategorySortByMaxPriceDesc : A category sorted by max price desc.
  • CategorySortByMaxPriceAsc : A category sorted by max price desc.
  • sortByFeedbackDesc : Sorted by feedback desc.
  • sortByFeedbackAsc : Sorted by feedback asc.
  • sortByRatingDesc : Sorted by rating desc.
  • sortByRatingAsc : Sorted by rating asc.

4. Cart-Controller:

  • addToCart : Add a product to cart.
  • viewCart : View user cart.
  • modifyCart : Modify a product in cart.
  • deleteFromCart : Delete a product from cart.

5.Order-Controller:

  • placeDirectOrder : Place an order with card credentials and shipping address from product page.
  • placeCartOrder : Place order with seleted products from cart.
  • placeCartOrderAll : Place order of all the products in cart.
  • viewOrderDetailById : View order detail by order id.
  • viewOrders : View all order details in List.
1. For now the order can be placed with card only. 
2. sessionId need to pass with user id to authenticate. I have skipped spring security and implemented manual mode to genarate UUID.

6. Admin-Controller:

** Use the above admin credential and login first to genarate UUID/SessionId for admin. This UUID will be needed to use the service in admin controller.

  • getAllUser : Get list of all users registered in the database.
  • addNewCard : Add new dummy card credential with balance. CardNo, CardPin, Balance.
  • addBalance : Add balance to a registered card.
  • registerCatagory : Register a new category. Note the category id and use it while registering a new product.
  • getAllCategory : Get a list of all registered category.
  • registerProduct : Registed a new product with a category id.
  • addPostalCodes : Add a new postal code or list of postal codes. While filling the shipping address and pin code the system will check if pin code is registered to give service or else it will not be deliverable.
  • deactivePostalCodes : Deactivate a postal code or postal codes to prevent placing order to that area.
  • reactivePostalCodes : Reactivate a postal code or postal codes to all user to order to that area.
  • addPaymentMethod: Add supported paymethods, i.e card, upi, cash, etc.
  • deactivatePaymentMethod : Deactivate a payment method to prevent user to pay for a order using that method.
  • reactivatePaymentMethod : Reactive a payment method.
Admin report:
  • viewOrderByCardNo : Get list of orders paid by a card by card no.
  • viewOrderByPostalCode : Get list of orders delivered to a postal code by postal code.
  • viewOrderByCity : Get list of orders delivered to a city by city name.
  • viewOrderByState : Get list of orders delivered to a state by state name.
  • viewOrderByState : Get list of orders ordered by a customer by user id.

There are still scope of so many more API based on business logic and demand. Hope you have fun playing and liked it. 

Thank you...

About

This is a E-Commerce App which provide web service. This service can be used to generate REST API. User can sign in, sign up, search a product and buy it. Also with admin access, new product can be added and report can be generated to look upon sales.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages