An Amazon-like storefront with MySQL. The app will take in orders from customers and deplete stock from the store's inventory. As a bonus task, you can program your app to track product sales across your store's departments and then provide a summary of the highest-grossing departments in the store.
MySQL database called bamazon
created with table inside called products
. The products table has 10 items inserted with the following columns:
-
item_id (unique id for each product)
-
product_name (Name of product)
-
department_name
-
price (cost to customer)
-
stock_quantity (how much of the product is available in stores)
Customer runs a Node app called bamazonCustomer.js
which first displays all of the items available for sale minus the stock quantity.
The app then prompts users with two messages.
- The first should ask them the ID of the product they would like to buy.
- The second message should ask how many units of the product they would like to buy.
Once the customer has placed the order, your application should check if your store has enough of the product to meet the customer's request.
- If not, the app should log a phrase like
Insufficient quantity!
, and then prevent the order from going through.
If the store does have enough of the product, the customer's order is fulfilled and updates the SQL database to reflect the remaining quantity and shows the customer the total cost of their purchase.
A new Node application called bamazonManager.js
that lists a set of menu options:
-
View Products for Sale
-
View Low Inventory
-
Add to Inventory
-
Add New Product
-
Exit
If a manager selects View Products for Sale
, the app should list every available item: the item IDs, names, prices, and quantities.
If a manager selects View Low Inventory
, then it should list all items with an inventory count lower than five.
If a manager selects Add to Inventory
, your app should display a prompt that will let the manager "add more" of any item currently in the store.
If a manager selects Add New Product
, it should allow the manager to add a completely new product to the store.
A new Node application called bamazonSupervisor.js
that lists a set of menu options:
-
View Product Sales by Department
-
Create New Department
-
Exit
When a supervisor selects View Product Sales by Department
, the app will display the following summarized table in their terminal/bash window based on a new table called departments
created in the bamazon schema.
The total_profit
column is a customer aliias and is calculated on the fly using the difference between over_head_costs
and product_sales
by joining the departments
and products
table and ordering the table by Department ID.
The Create New Department
option allows the supervisor to add a new department much in the same way that the manager can add a new product in the bamazonManager.js
app.