This is a CLI application that takes in orders from customers and depletes stock from the store's inventory.
- The App will prompt users/customers with two messages.
- The first message will prompt customers to enter the
item_id
of the product they would like to buy. - The second message will ask how many units of the product they would like to buy.
- Once the customer has placed their order, the application will check if bamazon store has enough of the product in stock to meet the customer's request.
- If not, the app will log a phrase like
insufficient quantity!
, and then prevent their order from going through.
NPM Pkgs Installed | Package Uses |
---|---|
console.table | Adds console.table method for convenience |
inquirer | A collection of common interactive command line user interfaces |
mysql | This is a node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed |
-
To see bamazon's full product inventory, you will need to type
mysql -u root
ormysql -u root -p
to access mysql in GitBash/Terminal.Next, type the following commands in this order:
-
- show databases;
-
- use bamazon_db;
-
- show tables;
-
- select * from products;
Type
exit
and pressenter
to exit mysql. -
-
To run this application, type this in your GitBash/Terminal
node bamazonCustomer.js
and pressenter
.- Once an item's stock has been depleted, it will be (
removed) from the customer's view, you should see the products table displayed with available items; just like you see below:
- Notice that (
item_id 7) had aquantity of zero
and has been (removed from the customer's view) because this item is no longer available.
- Once an item's stock has been depleted, it will be (
-
Customer will be prompted with two questions to make an item selection then
enter
the quantity they would like to buy.If customer makes an
invalid entry
, they will be prompted to make a valid selection: -
When customer makes a valid selection, their
order total
will be displayed like this: -
bamazon inventory will also be
updated to reflect new available stock
. -
Customers can now place another order until all inventory has been depleted.