Delete search items

This commit is contained in:
Sean Edmunds
2025-02-21 16:07:17 -06:00
parent 78d9b0ec7f
commit 5597721b9b

View File

@@ -484,5 +484,19 @@ app.post("/trigger/api/searchHistory", async (req, res) => {
conn.end(); conn.end();
}); });
app.delete("/trigger/api/searchHistory", async (req, res) => {
const conn = await pool.getConnection();
const query = `DELETE FROM trigger_database.searchHistory WHERE id = '${req.body.id}'`;
conn
.query(query)
.then((rows) => {
res.status(200).send({ status: "success" });
})
.catch((err) => {
res.status(500).send({ error: err });
});
conn.end();
})
// app is listening on port 5000 // app is listening on port 5000
app.listen(5000, "0.0.0.0", () => {}); app.listen(5000, "0.0.0.0", () => {});