var express = require("express");
const router = express.Router();
const db = require("../../utils/database");

router.post("/deleteConfig", (req, res) => {
  const id = req.body.id;

  db.getConnection((err, connection) => {
    if (err) {
      console.log("database not connected error: >>>", err);
      res.send(500).status({
        msg: "Error from database",
        err: err,
      });
    }
    let query = `delete from finehhdi_CIL.CILConfig where id=${id}`;
    console.log("Delete Query", query);
  
    connection.query(query, (err, data) => {
      Connection.release();
      if (err) {
        console.log("error found", query);
      } else {
        res.status(200).json({
          message: "Successfully Deleted",
          results: "success",
        });
      }
    });
  })
});
module.exports=router