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™.
- Registration [POST]
- Before being able to purchase products, a user has to first register.Your application should prevent registration using the same usernameand email.
- Only username, email and password are required to register an account.
Password should be encrypted (Bonus)
- Login [POST]
- If the user has entered the correct credentials, they may proceed to the
corresponding page based on their authorities.
- 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.”
- Home Pagea. The user is able to view all of the products. An out of stock product should NOTbe shown to the user. [GET]
- 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]
- 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]
- Purchasing
- 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.
- 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.
- 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]
- Product Watchlist
- The user can add/remove products to/from their watchlist.
- The user should not be able to add a product that is already on thewatchlist [POST]
- The user should not be able to remove a product that is not on thewatchlist [DELETE]
- The user can view all in stock products within their watchlist. [GET]
- When viewing the watchlist, products which are out of stock will not beshown to the user.
- Summary
- 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.
- The user can then click and look into any one specific order created by them,completed with the items included in that order. [GET]
- 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.
- Home Page
- The seller should be able to view a dashboard, consisting of the following:
- 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)
- The seller can click and see information regarding any singleorder, completed with the items involved in the order.
- 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]
- 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.
- The retail price is the price which customers pay for the product.
- Selling
- When one product is sold, the quantity of that product should be deductedaccordingly. And such quantity should be reflected on the dashboard.
- Order
- The seller should be able to complete a “Processing” order by updating itsstatus to “Completed”. [PATCH]
- 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]
- Summary
- The seller can see which product brings the most profit. [GET]
- 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]
- Additional Features (Bonus)
- 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:
- Authentication: Guests cannot access any endpoints other than for login or registrationusage.
- Authorization: A user with the corresponding authorities can access certain pages thatthey are granted access to.
- 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
- Any other relevant information
Exception Handling
- 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.