From ab4994bbe12efa0ab65f0c4c4f7634dce976c857 Mon Sep 17 00:00:00 2001 From: Tatiana Stewart Date: Mon, 8 Jan 2024 02:14:06 -0500 Subject: [PATCH] --- server/app.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/server/app.js b/server/app.js index 29585df..e377fd0 100644 --- a/server/app.js +++ b/server/app.js @@ -52,7 +52,7 @@ app.get("/api/database/search", async (req, res) => { OR instrument LIKE ? OR status LIKE ? OR notes LIKE ?`; - const [search] = await pool.query(searchSql, [`%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`]); + const [search] = pool.query(searchSql, [`%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`, `%${q}%`]); res.status(200).json({ search }); } catch (error) { @@ -70,7 +70,7 @@ app.post("/api/database/new", async (req,res) => { `SELECT * FROM prints WHERE catalog_number LIKE ?`; - [check] = await pool.query(checkExistingRecord, [catalog_number]); + [check] = pool.query(checkExistingRecord, [catalog_number]); if (check.length > 0) { res.status(400).json({ message: "This is a Duplicate Entry" }) @@ -80,18 +80,18 @@ app.post("/api/database/new", async (req,res) => { `INSERT INTO prints (catalog_number, artist, image, year, location, size, instrument, status, notes, date_sold) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`; - await pool.query(insertRecord, [ - catalog_number, - artist, - image, - year, - location, - size, - instrument, - status, - notes, - date_sold, - ]); + pool.query(insertRecord, [ + catalog_number, + artist, + image, + year, + location, + size, + instrument, + status, + notes, + date_sold, + ]); res.status(200).json({ message: "Record Added!"}); } } catch (error) { @@ -121,7 +121,7 @@ app.put("/api/database/update/:id", async (req, res) => { date_sold = ? WHERE idprints = ?`; - await pool.query(updateRecord, [catalog_number, artist, image, year, location, size, instrument, status, notes, date_sold, printId]); + pool.query(updateRecord, [catalog_number, artist, image, year, location, size, instrument, status, notes, date_sold, printId]); res.status(200).json({ message: "Record updated!" }); } catch (error) { @@ -135,7 +135,7 @@ app.put("/api/database/update/:id", async (req, res) => { // Start the server -const PORT = process.env.DB_PORT || 3000; +const PORT = process.env.DB_PORT || 5501; app.listen(PORT, () => { console.log(`Server is running on port ${PORT}`); });