- System from the start has products that can be sold. Each product contains:
- Id
- Name
- Price
- System from the start has users that can buy products. Each user has:
- Id
- First name
- Last name
- Amount of money
- System has menu that supports next operations:
- Display list of all users
- Display list of all products
- User should be able to buy product, to do this operation we should enter:ID of user who want to buy productId of product which user want to buy
- If user doesn't have enough money to buy product, throw exception
- If user successfully bought the product display message about successful purchase
- When user is buying product, his amount of money decreases by product price
- After successful purchase, information about user and his products has to be stored in collection best suited for that purpose
- Display list of user products by user id (If user didn't buy anything yet, don't show anything)
- Display list of users that bought product by product id (If nobody bought this product yet, don't show anything)
- System starting without users and products, add next operations to menu:
- Ability to add new users to the system (with autogenerated id, not null fields validation and check for numbers in amount of money field)
- Ability to add new products to the system (with autogenerated id, not null fields validation and check for numbers in price field)
- Ability to delete products and users, if product deleted, it has to disappear from all users purchases
- If exception is thrown, don't crash application and show menu again, display error message to understand reason of error
- Add Spring Boot to application
- Add relational database and Hibernate to application for persistence storage
- Get rid of console menu and move all the logic to REST endpoints
- Implement global error handling and user-friendly exception messages with correct HTTP statuses