function productAdd() {
  inquirer
    .prompt([
      {
        name: "product_name",
        type: "input",
        message: "What is the name of the product you would like to add?",
      },
      {
        name: "department_name",
        type: "input",
        message: "What department is the product in?",
      },
      {
        name: "author_artist",
        type: "input",
        message: "What is the name of the author/artist?",
      },
      {
        name: "price",
        type: "input",
        message: "What is the cost of the item?",
        filter: Number
      },
      {
        name: "stock_quantity",
        type: "input",
        message: "How many items of the product would you like to stock?",
        filter: Number
      },
    ]).then(function (answers) {
      var queryStr = "INSERT INTO products SET ?";
      connection.query(queryStr, answers, function (err, res, fields) {
        if (err) throw err;
        console.log("New product has been added to the inventory.")
      })
      itemsAvailable();
    })
}
// Allow users to add a new product to the inventory.
Allow users to add a new product to the inventory.
Allow users to add a new product to the inventory .
function productAdd() {
  inquirer
    .prompt([
      {
        name: "product_name",
        type: "input",
        message: "What is the name of the product you would like to add?",
      },
      {
        name: "department_name",
        type: "input",
        message: "What department is the product in?",
      },
      {
        name: "author_artist",
        type: "input",
        message: "What is the name of the author/artist?",
      },
      {
        name: "price",
        type: "input",
        message: "What is the cost of the item?",
        filter: Number
      },
      {
        name: "stock_quantity",
        type: "input",
        message: "How many items of the product would you like to stock?",
        filter: Number
      },
    ]).then(function (answers) {
      var queryStr = "INSERT INTO products SET ?";
      connection.query(queryStr, answers, function (err, res, fields) {
        if (err) throw err;
        console.log("New product has been added to the inventory.")
      })
      itemsAvailable();
    })
}
function productAdd ( ) { inquirer . prompt ( [ { name : "product_name" , type : "input" , message : "What is the name of the product you would like to add?" , } , { name : "department_name" , type : "input" , message : "What department is the product in?" , } , { name : "author_artist" , type : "input" , message : "What is the name of the author/artist?" , } , { name : "price" , type : "input" , message : "What is the cost of the item?" , filter : Number } , { name : "stock_quantity" , type : "input" , message : "How many items of the product would you like to stock?" , filter : Number } , ] ) . then ( function ( answers ) { var queryStr = "INSERT INTO products SET ?" ; connection . query ( queryStr , answers , function ( err , res , fields ) { if ( err ) throw err ; console . log ( "New product has been added to the inventory." ) } ) itemsAvailable ( ) ; } ) }
Allow users to add a new product to the inventory.
Allow users to add a new product to the inventory .