You are a budding entrepreneur who devised an idea to build an e-commerce giant like Amazon, Flipkart, Walmart, etc. As part of this ambition, you want to build a platform to duplicate the concept of Limited Time Deals.
A limited-time deal implies that a seller will put up an item on sale for a limited period, for example - 2 hours, and will keep a maximum limit on the number of items that would be sold as part of that deal.
Users cannot buy the deal if the deal time is over.
Users cannot buy if other users have already bought all the items in the deal.
Users can buy up to one item as part of the deal.
The task is to create APIs to enable the following operations
Create a deal with the price, end time(optional) and number of items to be sold as part of the deal.
End a deal.
Update a deal to increase the number of items or end-time.
Claim a deal (Basically, creating an order. No need to take care of item price or payment).
Document and communicate your assumptions in README.
Create a working solution with production-quality code.
Use an external database like Postgres/MySQL or any NoSQL database
Define and Create APIs to support the operations mentioned above
Write a few unit tests for the most important code
What are we looking for?
Your approach to the solution
How you write code in terms of readability and maintainability
Usage of best practices
Testing skills
You are expected to write code for the complete application and build at least one end-to-end feature. However, a complete working solution is NOT expected.
- Build commands
ruchirgupta@Ruchirs-MacBook-Pro demo-service % mvn clean install package -DskipTests && mvn spring-boot:run
- Run with specific profile
ruchirgupta@Ruchirs-MacBook-Pro demo-service % mvn clean install package -DskipTests ruchirgupta@Ruchirs-MacBook-Pro demo-service % mvn spring-boot:run -Dspring-boot.run.profiles=local ruchirgupta@Ruchirs-MacBook-Pro demo-service % mvn spring-boot:run -Dspring-boot.run.profiles=dev ruchirgupta@Ruchirs-MacBook-Pro demo-service % mvn spring-boot:run -Dspring-boot.run.profiles=qa ruchirgupta@Ruchirs-MacBook-Pro demo-service % mvn spring-boot:run -Dspring-boot.run.profiles=prod
- Build commands with jar
ruchirgupta@Ruchirs-MacBook-Pro demo-service % mvn clean install package -DskipTests ruchirgupta@Ruchirs-MacBook-Pro demo-service % java -jar target/demo-service-1.0-SNAPSHOT.jar ruchirgupta@Ruchirs-MacBook-Pro demo-service % java -jar -Dspring.profiles.active=local target/demo-service-1.0-SNAPSHOT.jar ruchirgupta@Ruchirs-MacBook-Pro demo-service % java -jar -Dspring.profiles.active=dev target/demo-service-1.0-SNAPSHOT.jar ruchirgupta@Ruchirs-MacBook-Pro demo-service % java -jar -Dspring.profiles.active=qa target/demo-service-1.0-SNAPSHOT.jar ruchirgupta@Ruchirs-MacBook-Pro demo-service % java -jar -Dspring.profiles.active=prod target/demo-service-1.0-SNAPSHOT.jar
- Demo-service swagger
Once the application is up, Open the local swagger URL is Swagger Doc