Giter Site home page Giter Site logo

bamazon's Introduction

bamazon

a command line (mock) product marketplace

This CLI uses node and the inquirer and mysql packages to ask the user which items (from a displayed list of items from a MySQL database currently containing dummy data) they would like to purchase, and their prices. If the desired quantity is available, the purchase will complete. If not, a message to the user explaining the shortage displays before showing the full item display again (to effectively restart the app).

Here is what our terminal looks like when a user starts the app-- an inventory of the mock database opens up, displaying the item ID, product name and price (hidden from the user are other fields such as stock quantity and department name):

Screenshot

This view is of a successful purchase, which happens when the user requests a quantity that is available in the inventory. We know the quantity requested is available because of a query that checks the database against the user's request. If successful, the total cost will display to the user, and a second query will update the database to remove the requested items from the inventory. I've included a console.log of the result in this screenshot to demonstrate that the database successfully updated.

Screenshot

Below is what happens when a user selects an item/quantity for which the database has insufficient quantities. The user is displayed a failure message and invited to begin the process again with an inventory display.

Screenshot

Here is a shot of the same failure with a console.log of the result. Because the second query never ran (due to failure in the first query), the result is showing the stock quantity and price of the item, which is what we asked for in the first query to make the user/DB comparison.

Screenshot

bamazon's People

Contributors

kristalane avatar

Watchers

James Cloos avatar

bamazon's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.