From fed9ea90a8bbdf4930f31fd4ed671833e33bdfe8 Mon Sep 17 00:00:00 2001 From: 65160111 <65160111@go.buu.ac.th> Date: Mon, 24 Mar 2025 19:40:09 +0700 Subject: [PATCH] edit route update report --- routes/reports.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routes/reports.js b/routes/reports.js index 7840b71..4d04f2e 100644 --- a/routes/reports.js +++ b/routes/reports.js @@ -120,10 +120,10 @@ router.get("/:id", authMiddleware, (req, res) => { // 🔹 Update Report (แก้ไขเฉพาะ Title, Description) router.put("/:id", authMiddleware, (req, res) => { - const { title, description } = req.body; + const { title, description, room_id } = req.body; db.query( - "UPDATE reports SET title=?, description=? WHERE id=?", - [title, description, req.params.id], + "UPDATE reports SET title=?, description=?, room_id=? WHERE id=?", + [title, description, room_id, req.params.id], (err, result) => { if (err) return res.status(500).json({ error: err.message }); res.json({ message: "Report Updated!" }); -- GitLab