Gitlab@Informatics

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

Project Round 8

parent 1a4c4c0c
Branches
No related tags found
No related merge requests found
......@@ -273,6 +273,17 @@ exports.searchTours = async (req, res) => {
//จองทัวร์
exports.getAllTours = async (req, res) => {
try {
const tours = await Tour.getAllTours();
res.render('booking', { tours }); // ส่งข้อมูลทัวร์ไปยัง booking.ejs
} catch (error) {
console.error('Error fetching tours:', error.message);
res.status(500).send('Internal Server Error');
}
};
exports.getUserBookings = (req, res) => {
const userId = req.user.id; // สมมติว่า req.user เก็บข้อมูลผู้ใช้ที่ล็อกอินแล้ว
bookingModel.getBookings(userId, (err, bookings) => {
......
......@@ -34,6 +34,7 @@ router.post('/edit-profile', tourController.updateProfile);// อัปเดต
//จองทัวร์
router.get('/my-bookings', tourController.getUserBookings);
router.get('/createbooking', tourController.getAllTours);
router.post('/createbooking', tourController.createBooking);
router.post('/cancel/:id', tourController.cancelBooking);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment