function getWaitingPatients(db) {
  return new Promise((resolve, reject) => {
    db.query(
      `
      SELECT id, firstname, lastname, birthdate
      FROM patients
      WHERE waiting_room = 1
        AND active = 1
      ORDER BY updated_at ASC
      `,
      (err, rows) => {
        if (err) return reject(err);
        resolve(rows);
      }
    );
  });
}

module.exports = {
  getWaitingPatients
};
