/bamazon

CLI storefront integrating a MySQL database

Primary LanguageJavaScript

Bamazon

Command-line storefront application integrating a MySQL database

Contents

Concept

A command-line storefront application integrating a MySQL database to track and update stock quantities of available products. Friendly messages alert the customer key information about their transactions.

Technologies Used

MySQL, Node.js, JavaScript, and the packages NPM MySQL, Inquirer, Colors.js & CLI-Table

Key Features

  • Check for sufficient stock level before completing purchase process
  • Table view of products for sale

Application Video

Video of application in action


Screenshots: "bamazonCustomer" View

  • View of successfully processed order (entire process)

order1


Step-by-step screens

  • User types 'node bamazonCustomer.js' to initialize the program

First view ~ Welcome and Products Table

order1_a

  • Table displays available products by their id, product name, and retail price
  • User is prompted to enter an id and qty of an item they wish to purchase

Second view ~ Cart and In-Stock Process

order1_b

  • Items and quantity the user selected are logged
  • A function is triggered to check if there's enough stock of the item to complete the purchase
  • If there is enough stock on hand, a "success" message is logged
  • Next, a "receipt" is generated, totaling the cost of the items and thanking the user
  • When the quantity is successfully deducted from the database, "order successful" logs
  • Finally a new prompt asks the user if they'd like to continue shopping

Continue Shopping ~ Yes

order2_a

  • Confirming "yes" triggers the product display table and initial purchase prompts

Out-of-Stock Process

order3_a

  • If the user enters a quantity that is out of stock, a message is logged that the "order cannot be fulfilled"
  • The product display table is triggered again

Final View ~ Order Successful, End Shopping

order3_b

  • After another successful order, the user is again asked if they'd like to continue shopping
  • Confirming "no" logs a message to "have a great day"

Database Inventory View Before Sales

db_start

Database Inventory View After Sales

db_end

  • The quantity of items from the examples have been deducted successfully

Thanks for reading. Happy shopping!