bamazonCustomer.js
// After the customer declares quantity, db calculates quantity in the warehouse for that particular product
After the customer declares quantity, db calculates quantity in the warehouse for that particular product
After the customer declares quantity db calculates quantity in the warehouse for that particular product
function makePurchase(product, quantity) {
    connection.query(
        'UPDATE products SET stock_quantity = stock_quantity - ? WHERE item_id = ?',
        [quantity, product.item_id],
        function(err, res) {
            console.log(res);
            loadProducts();
        }
    )
}
function makePurchase ( product , quantity ) { connection . query ( 'UPDATE products SET stock_quantity = stock_quantity - ? WHERE item_id = ?' , [ quantity , product . item_id ] , function ( err , res ) { console . log ( res ) ; loadProducts ( ) ; } ) }
After the customer declares quantity, db calculates quantity in the warehouse for that particular product
After the customer declares quantity db calculates quantity in the warehouse for that particular product