Bamazon is an Amazon-like storefront that takes in orders from customers and deplete stock from the store's inventory via a console interface.
Bamazon is a command line node app, which complies with the guidelines of:
- Utilizing npm packages to access and format data.
- Establishing a package.json for npm package version info and install requirements.
- Deploying to GitHub.
This command line app is useful as a tool for working with database data through interaction and input from a user. It provides an example of how npm packages can be utilized to assist in connecting to a database, and working with console logging table data from a database response.
Upon loading, Bamazon presents the user with:
- A display all of the available items. This includes the ids, names, and prices of products for sale.
-
The app should then prompt users with two messages.
- The first asks them the ID of the product they would like to buy.
- The second asks how many units of the product they would like to buy.
- If the store has enough of the product, the order is fulfilled.
- The SQL database is updated to reflect the remaining quantity.
- The total cost of the purchase is presented to the customer.
-
If the store doesn't have enough of the product, the app logs a phrase of
insufficient quantity
, and then prevents the order from going through.
- The manager is presented with five available 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 lists every available item: the item IDs, names, prices, and quantities.
- If a manager selects
View Low Inventory
, it lists all items with an inventory count lower than five.
- If a manager selects
Add to Inventory
, the app displays a prompt that will let the manager "add more" of any item currently in the store.
- If a manager selects
Add New Product
, it allows the manager to add a completely new product to the store.
- If a manager selects
Exit
, it quits the manager interface.
In order to provide the user with this information, the following are used:
- npm - inquirer
- npm - mysql
- npm - console.table
- MySQL database
- sql schema and seeds for database
Bamazon was created by Scott Johnson.