Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit fb945947 authored by 65160014's avatar 65160014
Browse files

Initial commit

parent 79dca686
No related branches found
No related tags found
No related merge requests found
......@@ -119,18 +119,14 @@ exports.bookingSummary = async (req, res) => {
if (!appointmentId) {
return res.status(400).send("ไม่พบรหัสการจอง");
}
// พยายามดึงข้อมูลการจองจากตารางหลัก
// ดึงข้อมูลการจองจากทั้ง appointments และ appointment_history
let appointment = await bookingModel.getAppointmentById(appointmentId);
// ถ้าไม่พบ ลองดึงจากตารางประวัติ (appointment_history)
if (!appointment) {
appointment = await bookingModel.getAppointmentFromHistoryById(appointmentId);
if (!appointment) {
throw new Error("ไม่พบการจอง");
}
throw new Error("ไม่พบการจองในฐานข้อมูล");
}
const user = await bookingModel.getUserById(appointment.user_id);
const service = await bookingModel.getServiceById(appointment.service_id);
const slot = await bookingModel.getBookingSlotById(appointment.booking_slot_id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment