This activity is about creating storefront with node.js and MySQL.
There are three applications in this exercise:
To use the applications:
yarn
and press .env
..env
file, create the following entries:DB_USER=<mysql_db_user>
DB_PASSWORD=<mysql_db_user_password>
There should be no spaces around the equal sign, and the values should not be surrounded by quotes.
bamazon.sql
file.mysql -u root < bamazon.sql
mysql -u root < bamazon_supervisor.sql
When the bamazonCustomer.js
application is launched, a list of the currently available products are displayed. The customer is then asked to choose an item for purchase, by entering the Id of the item. If they have selected a valid Id, then they are asked to enter how many of the selected product they would like to purchase. If the item Id and the quantity to purchase are valid, the sale is completed and the customer is shown the total price for their purchase. They are then asked if they’d like to make another purchase or exit.
The images below demonstrate each of the functions required by the exercise.
These demonstrations shows the ability to quit from the purchasing screens
This demonstration shows input validation for the product Id. This is when the customer enters an Id for something that is not in the list displayed.
This demonstration shows input validation for the stock amount. Primarily for those cases where the customer attempts to purchase more than are available in stock.
This demonstrates a successful purchase, including the display of the final purchase price.
The bamazonManager.js
application presents the manager with a menu of options for managing store inventory.
View Products for Sale lists all of the items in the store:
View Low Inventory lists all items that have a stock quantity less than 5.
Manage Stock Levels allows the manager to update the amount of available stock for any item in the store.
Add New Product allows the manager to add a new product to the store.
The bamazonSupervisor.js
application presents the supervisor with a menu of options:
View Product Sales by Department displays the Sales by department joining information from the products
and departments
tables and adding a calculated column in the query result.
Create New Department allows the supervisor to add another department (product category) for new products.