Skip to content
This is an Amazon-like storefront using MySQL. The app displays products for sales, takes in orders from customers and depletes stock from the store's inventory listed in MySQL after a purchase. This app also provides a manager view which allows the user to display product information, add to inventory, view low inventory items and add new produ…
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images
.gitignore
README.md
bamazonCustomer.js
bamazonDB.sql
bamazonManager.js
package-lock.json
package.json

README.md

Bamazon - Node.js & MySQL

Description

This is an Amazon-like storefront using MySQL. The app displays products for sales, takes in orders from customers and depletes stock from the store's inventory listed in MySQL after a purchase. This app also provides a manager view which allows the user to display product information, add to inventory, view low inventory items and add new products.

Built With

  1. Node.js
  2. JavaScript
  3. MySQL
  4. NPM Inquirer
  5. NPM Dotenv
  6. NPM Table
  7. NPM MySQL

To Use

  1. You will need to fork the repository to your own github, the pull it into your local drive. You will need installed on your local computer:
  1. Once you have these items on your computer and the repository folder on your computer open in git bash you can enter the code: npm install This will install the required npm packages. To view these required npms look into the package.json file. The include: inquirer, dotenv, table and mysql.
  2. You will need to open mySQL Workbench and add the database and table.
  3. You will need to create a .env file that contains your password for mySQL in the following format (enter your password where the stars are: MYSQL_PASSWORD="*********"
  4. YOu can choose either bamazonCustomer.js or bamazonManager.js to node to start the application. Do this by opening your gitbash and go into the folder where the repository is held and in the command line type node bamazoncustomer.js for the customer option or node bamazonmanager.js for the manager view. Please note: if there is an error or issue with node not ending the program - press CNTRL C

View Options

Customer View (bamazonCustomer.js)

  1. Displays product information information including:
    • 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)

  1. The app prompts the user the ID of the product they would like to buy.
  2. The second prompt asks how many of selected product they would like to buy.
  3. Once the user has placed the order, the application checks:
    • if the store has enough of the product to meet the user's request.
    • if not, the app log the phrase "Insufficient quantity!", and prevents the order from going through.
    • if the store does have enough of the product, the order is filled and the total price, the item and quantity is logged.

* The app then updates the SQL database to reflect the remaining quantity.

Manager View (bamazonManager.js)

  1. List a set of menu options:
    • View Products for Sale
    • View Low Inventory
    • Add to Inventory
    • Add New Product
    • End Program

Manager Menu

  1. If a manager selects View Products for Sale, the app list every available item: the item IDs, names, prices, and quantities.

Display Order

  1. If a manager selects View Low Inventory, then it lists all items with an inventory count lower than five.

View Low Inventory

  1. 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.

Add to Inventory

  1. If a manager selects Add New Product, it should allow the manager to add a completely new product to the store.

Add New Product

Issues

I was not able to get the table view to work properly or stacked. If you find any other issues while using the app or have a request or solution, please email me at bracewell.sara@gmail.com. Thank you for your time and suggestions!

You can’t perform that action at this time.