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

---
 models/tourModel.js | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/models/tourModel.js b/models/tourModel.js
index e19e47e..cd865a8 100644
--- a/models/tourModel.js
+++ b/models/tourModel.js
@@ -29,14 +29,12 @@ class Tour {
     }
   
     // สร้างทัวร์
-    static async createTour(tourData) {
-      const { name, description, price, duration } = tourData;
-  
+    static async createTour(name, description, price, duration) {
       // ตรวจสอบข้อมูล
       if (!name || !price || !duration) {
         throw new Error('ข้อมูลไม่ครบถ้วน กรุณากรอกข้อมูลให้ครบถ้วน');
       }
-  
+
       const query = 'INSERT INTO tours (name, description, price, duration) VALUES (?, ?, ?, ?)';
       try {
         await pool.execute(query, [name, description, price, duration]);
@@ -45,6 +43,7 @@ class Tour {
         throw new Error('เกิดข้อผิดพลาดในการสร้างทัวร์');
       }
     }
+
   
     // อัปเดตทัวร์
     static async updateTour(id, tourData) {
@@ -74,7 +73,7 @@ class Tour {
         throw new Error('เกิดข้อผิดพลาดในการลบทัวร์');
       }
     }
-  }
+}
 
 class User {
     static async findOne(email) {
-- 
GitLab