This application implements an Amazon-like store front built using Node.js and MySQL, and run at the command line. It is built using the following npm packages:
- mysql
- inquirer
- console.table
The application has two interfaces, customer and manager.
In order to run this application, MySQL needs to be installed and running on your machine. If you don't have it installed, please visit the MySQL Community Downloads page. After MySQL is installed and running, you'll need a client to interact with the database to set it up and populate it with data. The bamazon_db.sql file is included that contains the commands to accomplish this.
The user is initially presented with the current inventory of store items including: item_id, product_name, department_name, price and stock_quantity. The user is then prompted to select an item (by item number) and the desired quantity. If the selected quantity is available the order is fulfilled, and the order summary is displayed (product, unit_price, qty_ordered, total_price). Finally, the database is updated with the new stock_quantity of the ordered product. If the desired quantity is not available, the user is prompted to modify their order.
To run the customer interface, follow the steps below:
git clone git@github.com:dpkillian/bamazon.git
cd bamazon
npm install
node bamazonCustomer.js
The user/manager is initially presented with the four choices:
- view all products
- view low inventory (items that have less than 5 units)
- change total inventory
- add a new item
Once selecting a choice, the application display either the desired info, or else the user is prompted for the further inputs. For instance, when selecting "change total inventory", the user is queried for an item numnber and the new total quantity.
To run the manager interface, after first cloning and installing bamazon, type the following:
node bamazonManager.js
After typing "node bamazonCustomer.js", the user is presented with the following screen.
Initial screen shot of bamazonCustomer.js
Initial screen shot of the bamazon_db in Sequel Pro
Selecting item 1 (air compressor), the user is then asked for the quantity (10):
The order summary is showing the details of the order:
Looking at the updated Sequel Pro screen, the stock_quantity is changed to reflect the new inventory total:
After typing "node bamazonManager.js", the user is presented with the following screen.
Initial screen shot of bamazonManager.js
Selecting "View products for sale"
Selecting "View low inventory"
Selecting "Change total inventory", and selecting item 8 (lotion) and changing to 1200 units total
Selecting "View products for sale" to validate that item 8 (lotion) now had 1200 units