From bda8d3247ff4bd34f9947ce48dbfa3264ee379c7 Mon Sep 17 00:00:00 2001
From: Atiwit Pattanapukdee <65160394@go.buu.ac.th>
Date: Wed, 26 Mar 2025 17:30:36 +0700
Subject: [PATCH] Project Round 11

---
 controllers/tourController.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/controllers/tourController.js b/controllers/tourController.js
index ed46e9c..71a3fc2 100644
--- a/controllers/tourController.js
+++ b/controllers/tourController.js
@@ -225,7 +225,7 @@ exports.getEditTour = async (req, res) => {
 
 
 exports.postEditTour = async (req, res) => {
-  const { name, description, price, duration } = req.body;
+  const { name, description, price, duration, companyid } = req.body;
   const tourId = req.params.id;  // ดึง id จาก URL parameters
 
   console.log('📥 Data received:', req.body);  // ตรวจสอบข้อมูลที่ได้รับจากฟอร์ม
@@ -234,11 +234,11 @@ exports.postEditTour = async (req, res) => {
     return res.status(400).send('ไม่พบข้อมูลทัวร์');
   }
 
-  if (!name || !description || !price || !duration) {
+  if (!name || !description || !price || !duration|| !companyid) {
     return res.status(400).send('กรุณากรอกข้อมูลให้ครบทุกช่อง');
   }
 
-  const tourData = { name, description, price, duration };
+  const tourData = { name, description, price, duration, companyid };
 
   try {
     const result = await Tour.updateTour(tourId, tourData); // ส่ง tourId และ tourData
-- 
GitLab