From 295319725532a9bc47189ed7e26f9f9353e606f7 Mon Sep 17 00:00:00 2001 From: Atiwit Pattanapukdee <65160394@go.buu.ac.th> Date: Thu, 20 Mar 2025 23:00:11 +0700 Subject: [PATCH] Project Round 9 --- controllers/tourController.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/controllers/tourController.js b/controllers/tourController.js index 7f8a9f1..5ae9c6f 100644 --- a/controllers/tourController.js +++ b/controllers/tourController.js @@ -210,12 +210,12 @@ exports.getEditTour = async (req, res) => { return res.status(404).send('ไม่พบข้อมูลทัวร์'); } - // ตรวจสอบว่ามี userId ใน tour หรือไม่ - if (!tour.user_Id) { + // ตรวจสอบว่ามี user_id หรือไม่ + if (!tour.user_id) { return res.status(500).send('ข้อมูลทัวร์ไม่สมบูรณ์'); } - if (tour.user_Id !== req.session.userId) { + if (tour.user_id !== req.session.userId) { return res.status(403).send('คุณไม่มีสิทธิ์แก้ไขทัวร์นี้'); } @@ -226,6 +226,7 @@ exports.getEditTour = async (req, res) => { } }; + exports.postEditTour = async (req, res) => { const { name, description, price, duration } = req.body; -- GitLab