Skip to content

markpython86/bamazon

Repository files navigation

Application

bamazon

Description

This is a node application to:

  • view and maintain product and department information
  • view and maintain product and department information
  • allow customer to place orders for products

Getting Started

Prerequsites

  1. Node.js must be installed (https://nodejs.org/en/download/)
  2. MySQL must be installed. At a minimum, the free Community Edition must be present (https://www.mysql.com/downloads/)
  3. A MySQL developer tool such as MySQL Workbench or Sequel Pro (https://dev.mysql.com/downloads/workbench/) is needed to create and seed the database

Installation

  1. Clone repository bamazon using the code -> git clone https://github.com/markpython86/bamazon.git bamazon
  2. Open a terminal session for the directory where the application was cloned to
  3. run npm install to install the dependencies
  4. Use the bamazaon.sql file to create the databases in MySQL

Using the Application

There are 3 js files that can be run from a terminal session. Details on executing each of these is found in sections below.

  1. node BamazonCustomer.js
    1. Purchase items and create an order
  2. node BamazonManager.js
    1. View products
    2. View products with low inventory
    3. Add Inventory to a Product
    4. Add a Product
    5. Delete Product
  3. node BamazonSupevisor.js
    1. View Product sales by Department
    2. Add a Department

General Instructions

  1. You must be in a terminal session for the directory that contains the application
  2. Use the up/down arrow keys to navigate thru options and lists
  3. Select an option or list item by pressing Enter or Return
  4. The options and lists generally have an Exit item that can be selected to exit the application
  5. Ctrl+c for windows or Command+c for Mac can be used to exit the application at any time

bamazonCustomer.js

  1. run node bamazonCustomer.js from a terminal session in the application directory
  2. A list of products is presented
  3. Select a product id to order
  4. Once a product is selected, reply to the prompt with the quantity to order
  5. A reply is provided indicating if the order is created or if there is not enough inventory
  6. Reply to the prompt to continue with another order or to exit the application Demo

bamazonManager.js

  1. run node bamazonManager.js from a terminal session in the application directory
  2. Six options are presented
  3. View products
    1. A list of all products and details is presented
  4. View products with low inventory
    1. Reply to the prompt with a quantity value
    2. A list is presented of all products with a stock quantity less than the quantity requested
  5. Add Inventory to a Product
    1. Rely to the prompts to provide a product item number and the additional inventory
    2. The product item number must exist
  6. Add a Product
    1. Rely to the prompts with the requested product information
    2. A product item number is automatically generated
    3. Product name must be unique
  7. Delete a product
    1. Rely to the prompts with the requested
    2. Pick the item ID that want to be deleted
    3. Table will be displayed after update
  8. Exit
    1. Terminate the Program

View products

Demo

View products with low inventory

Demo

Add Inventory to a Product

Demo

Add a Product

Demo

Delete a product Demo

Exit Demo

bamazonSupervisor.js

  1. run node bamazonSupevisor.js from a terminal session in the application directory
  2. Two options are presented
  3. View Product sales by Department
    1. A list of product sales and profits for each department is presented
  4. Add a Department
    1. Rely to the prompts with the requested department information
    2. A department item number is automatically generated
    3. Department name must be unique

View Product sales by Department Add a Department Demo

Technical Information

Database

  1. MySQL is used as the database
  2. Details for the database, tables and users can be found in the *.sql files

Packages

  1. cli-table provides formatting to display list data in a table (https://www.npmjs.com/package/cli-table)
  2. inquirer provides framework for user prompts (https://www.npmjs.com/package/inquirer)
  3. mysql provides connection to MySQL database (https://www.npmjs.com/package/node-mysql)

About

Node.js and MySQL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published