Skip to content

Amazon type application for further node and mySQL knowledge. Customer file has a set list of items and monitors available stock. Stock will deplete based upon user input of desired quantity. Manager file allows the user to audit product information.

Notifications You must be signed in to change notification settings

corey-mitchell/bamazon

Repository files navigation

bamazon

Amazon type application for further node and mySQL knowledge. Customer file has a set list of items and monitors available stock. Stock will deplete based upon user input of desired quantity. Manager file allows the user to audit product information.

Getting Started as a Customer

Run 'node bamazonCustomer' in terminal to begin. Available product will be displayed in a table for the user. User will then be prompted to input ID number of desired product: starting application;

After the user enters desired ID, the user will be asked the quantity they desire to purchase: Prompt

If the user does not supply an input that is a non-zero integer then they will be asked to enter a non-zero number: Not a number

Once these questions are successfully answered, the stock data column will be updated to reflect new available stock.

Original mySQL data:

mySQL data

Updated Data Row:

Updated mySQL data row

The user is then prompted that their order was successfully placed and given the total of their order: Successful order

If there is not enough stock to supply desired demand, the user will be updated in the console: Low stock

Getting Started as a Manager

Run 'node bamazonManager' in the terminal to begin. User will be prompted with a list of things to do with product: Application Start

After each task the user will be prompted with a question asking if they would like to do anything else: Additional tasks

If the user answers yes then they will be shown the starting list. If the user answers no then the connection will end.

Manager's options:

Option 1: View available products. If the user chooses this option then a table will display all of the information about all available products. Available Products

Option 2: View products with low inventory. If the user chooses this option, a table will display all the items that have a stock quantity lower than 5. Low stock products

Option 3: Add inventory to product. This options allows the user to add inventory to an exsisting product. It will first display the products available and ask the user to input a product ID (the user will be limited to only integars that are equal to a valid product ID). Add inventory start

After choosing a valid ID number, the user will be asked how much stock they would like to add. Add inventory second question

Once the stock is added, the user is prompted that the stock has been added and shown the updated items table. Updated inventory

Option 4: Add a product. As stated in the title of this option, the function here allows the user to add a new product to the table of available products. Once this option is selected, the user will be prompted to provide details for this new item. Details such as; product name, product department, product price and how much product is in stock. Add a product

Once these questions are answered, the terminal will display a table with the users input and ask them to double check that the information is correct.

Product checker

If the user answers no then they will be asked the questions again. Else they will be alerted that the product has been added to the database.

Product added

Prerequisites

Dependencies: mysql, inquirer, console.table

Terminal command for downloading dependencies

npm i mysql
npm i inquirer
npm i console.table

Initialize Dependencies

const mysql = require("mysql");
const inquirer = require("inquirer");
require("console.table");

Note: console.table is used just like console.log, e.g. console.table('table to be logged in console');

Author

About

Amazon type application for further node and mySQL knowledge. Customer file has a set list of items and monitors available stock. Stock will deplete based upon user input of desired quantity. Manager file allows the user to audit product information.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published