From feeb61ce2e907c2b247f122edbd5434ef3031f27 Mon Sep 17 00:00:00 2001
From: Atiwit Pattanapukdee <65160394@go.buu.ac.th>
Date: Tue, 18 Mar 2025 13:31:20 +0700
Subject: [PATCH] Project Round 3

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

diff --git a/controllers/tourController.js b/controllers/tourController.js
index 35f9447..92c31d0 100644
--- a/controllers/tourController.js
+++ b/controllers/tourController.js
@@ -89,16 +89,16 @@ exports.getCreateTour = (req, res) => {
 // บันทึกทัวร์ใหม่
 exports.createTour = async (req, res) => {
   try {
-    const { name, location, price, description } = req.body;
+    const { name, description, price, duration } = req.body;
 
     // ตรวจสอบว่าข้อมูลถูกต้อง
-    if (!name || !location || !price || !description) {
+    if (!name || !description || !price || !duration) {
       return res.status(400).send('กรุณากรอกข้อมูลให้ครบทุกช่อง');
     }
 
     await pool.query(
       'INSERT INTO tours (name, location, price, description) VALUES (?, ?, ?, ?)',
-      [name, location, price, description]
+      [name, description, price, duration]
     );
     res.redirect('/'); 
   } catch (error) {
@@ -133,7 +133,7 @@ exports.postCreateTour = async (req, res) => {
 };
   
   exports.postEditTour = async (req, res) => {
-    
+
     console.log('📥 Data received:', req.body);
     const { name, description, price, duration } = req.body;
     const tourData = { name, description, price, duration };
-- 
GitLab