Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit af178bdb authored by 65160394's avatar 65160394
Browse files

Project Round 9

parent 28ad9d57
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,12 @@ class Tour { ...@@ -102,7 +102,12 @@ class Tour {
// ลบทัวร์ // ลบทัวร์
static async deleteTour(id) { static async deleteTour(id) {
try { try {
// ตรวจสอบก่อนว่ามีทัวร์อยู่หรือไม่ console.log("Deleting tour with ID:", id); // เช็คค่า ID ที่รับมา
if (!id) {
throw new Error("Tour ID is required");
}
// ตรวจสอบว่าทัวร์มีอยู่จริง
const checkQuery = 'SELECT * FROM tours WHERE id = ?'; const checkQuery = 'SELECT * FROM tours WHERE id = ?';
const [tours] = await pool.execute(checkQuery, [id]); const [tours] = await pool.execute(checkQuery, [id]);
...@@ -125,6 +130,7 @@ class Tour { ...@@ -125,6 +130,7 @@ class Tour {
throw new Error('เกิดข้อผิดพลาดในการลบทัวร์'); throw new Error('เกิดข้อผิดพลาดในการลบทัวร์');
} }
} }
} }
class User { class User {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment