Online Shopping App Requirements

n58h2r發表於2024-10-06

Online Shopping App Requirements

Create a Shopping application which supports the following:

High Level Design(HLD):

  • Use Spring Boot, Hibernate (HQL, Criteria), MySQL, Spring Security + JWT, Spring AOP,Spring Validation to develop the backend.○ You CAN NOT use JDBC/JdbcTemplate, JPA repository, CRUD repository, or thenative query.

○ At least one of the DAO functions needs to be implemented with Criteria.

○ Using Spring AOP to handle all exception throws in the controller and return

HTTP response

  • Use Angular to develop the frontend.
  • RESTful application required following a layered architecture: RestController, service,repository.
  • Use Postman to present your project by calling your RESTful endpoints.
  • All required functionalities should be implemented.
  • If you are using a version control tool such as GitHub, please make your repository

PRIVATE!!!

The retailer tycoon, Super Duper Mart™, requires your assistance in setting up their onlineshopping website. The following is the requirement they sent over. Based on theserequirements, please come up with a RESTful application that is equipped with the necessaryendpoints to return the needed information for each of their requirements.

User (Buyer)

The users are able to shop for different products from Super Duper Mart™.

  1. Registration [POST]
  2. Before being able to purchase products, a user has to first register.Your application should prevent registration using the same usernameand email.
  3. Only username, email and password are required to register an account.

Password should be encrypted (Bonus)

  1. Login [POST]
  2. If the user has entered the correct credentials, they may proceed to the

corresponding page based on their authorities.

  1. If the user has entered incorrect credentials, a custom named exceptionInvalidCredentialsException’ should be thrown and handled by the Exceptionhandler. The message the user will get is: “Incorrect credentials, please tryagain.”
  1. Home Pagea. The user is able to view all of the products. An out of stock product should NOTbe shown to the user. [GET]
  1. When a user clicks on one product, the user should be redirected to the detailpage of that product, including the description and price (retail_price) of theproduct. (The user should NOT be able to see the actual quantity of any items).[GET]
  1. After purchasing the product, the user should be able to view order details

including, order placement time and order status which is Processing,

Completed or Canceled. [GET]

  1. Purchasing
  2. The user should be able to purchase listing items with a specified quantity bycreating a “Processing” order. After a user places an order, the item’s stockshould be deducted accordingly. [POST]The user should be able to purchase multiple different items within asingle order.
  1. If the quantity of an item that the user is purchasing is greater than the item’sstock, throw a custom exception named ‘NotEnoughInventoryException’ usingException Handler and the order should not be placed.
  1. The user should be able to cancel an order by updating the status from“Processing” to “Canceled”. If so, the item’s stock should be incrementedaccordingly to offset the auto-deduction that took place when the order is firstplaced. However, a “Completed” order cannot be changed to “Canceled”.[PATCH]
  1. Product Watchlist
  2. The user can add/remove products to/from their watchlist.
  3. The user should not be able to add a product that is already on thewatchlist [POST]
  1. The user should not be able to remove a product that is not on thewatchlist [DELETE]
  1. The user can view all in stock products within their watchlist. [GET]
  2. When viewing the watchlist, products which are out of stock will not beshown to the user.
  1. Summary
  2. The user should be able to view all their orders.代 寫Online Shopping App Requirements [GET]Note that the wholesale_price and retail_price of a product can beadjusted by the seller, implement something to prevent the adjustmentsfrom affecting previous orders.
  1. The user can then click and look into any one specific order created by them,completed with the items included in that order. [GET]
  1. The user should be able to view their top 3 most frequently purchased items.(excluding canceled order, use item ID as tie breaker) [GET]The user can also view their top 3 most recently purchased items. (excludingcanceled order, use item id as tie breaker) [GET]Admin (Seller)The seller, Super Duper Mart™, is able to list different products to sell. There is one and ONLYone seller, thus no need to keep user_id foreign keys in the product table.
  1. Home Page
  2. The seller should be able to view a dashboard, consisting of the following:
  3. Order information, with details of order placed time, users who placedhe order and the order status (Processing, Completed, Canceled).[GET]A page should only have 5 orders (Bonus)
  1. The seller can click and see information regarding any singleorder, completed with the items involved in the order.
  1. Listing information, the current products that are listed to sell. When theseller clicks on one product, the seller should be redirected to the detailpage of that product, including the description, wholesale_price, retail_price and stock’s quantity of the product; the seller should beable to modify the wholesale_price, retail_price, description andquantity of a product. [GET]
  1. Listing The seller should be able to add products. A product has fields includingescription, wholesale_price, retail_price and stock’s quantity. [POST]e wholesale price is the price which the seller paid for the product.
  1. The retail price is the price which customers pay for the product.
  1. Selling
  2. When one product is sold, the quantity of that product should be deductedaccordingly. And such quantity should be reflected on the dashboard.
  1. Order
  2. The seller should be able to complete a “Processing” order by updating itsstatus to “Completed”. [PATCH]
  1. The seller should also be able to cancel an order for some reasons, such as that

the product is sold out locally, by updating the order status to “Canceled”. If so,

the item’s stock should be incremented accordingly to offset the auto-deduction

that took place when the order is first placed. However, a “Canceled” order

cannot be completed, nor can a “Completed” order be canceled. [PATCH]

  1. Summary
  2. The seller can see which product brings the most profit. [GET]
  3. The profit is calculated as (retail price - wholesale price).

Note: This should address situations where the seller alters either thewholesale_price or retail_price, causing a discrepancy when comparingbetween the past orders and the current updated product details.This should not include “Processing” and “Canceled” orders.The seller can see which 3 products are the most popular/sold (excludingcanceled and ongoing order). [GET]c. The seller can also see the amount of total items sold successfully (excludingcanceled and ongoing order). [GET]

  1. Additional Features (Bonus)
  2. This part would be evaluated by your creativity and completeness of the design.Be creative and think outside of the box :) if you have time

Spring Validation

Using Spring Validation to validate the request in at least one POST request.

Security

Protect your application endpoints using Spring Security + JWT:

  1. Authentication: Guests cannot access any endpoints other than for login or registrationusage.
  1. Authorization: A user with the corresponding authorities can access certain pages thatthey are granted access to.
  2. They should not be able to access information that they don’t have access to:Any of seller’s functionalityAny of other user’s order information
  1. Any other relevant information

Exception Handling

  1. Your application must not crash during the presentation. Therefore, if an exceptionoccurs, you must handle it with Spring AOP and display the exception as a message tohelp yourself and others debug.

相關文章