Gitlab@Informatics

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

Initial commit

parent cd0bbbe7
No related branches found
No related tags found
No related merge requests found
......@@ -76,8 +76,12 @@ module.exports = {
// ฟังก์ชันเพิ่มเติมสำหรับหน้า bookingSummary
getAppointmentById: (appointmentId) => {
return new Promise((resolve, reject) => {
const sql = 'SELECT * FROM appointments WHERE appointment_id = ?';
db.query(sql, [appointmentId], (err, results) => {
const sql = `
SELECT * FROM appointments WHERE appointment_id = ?
UNION
SELECT * FROM appointment_history WHERE appointment_id = ?
`;
db.query(sql, [appointmentId, appointmentId], (err, results) => {
if (err) return reject(err);
if (results.length === 0) return reject(new Error('ไม่พบการจอง'));
resolve(results[0]);
......@@ -85,6 +89,7 @@ module.exports = {
});
},
getUserById: (user_id) => {
return new Promise((resolve, reject) => {
const sql = 'SELECT * FROM users WHERE user_id = ?';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment