const db = require("../db");
const {
  getWaitingPatients
} = require("../services/patient.service");

async function showDashboard(req, res) {
  try {
    const waitingPatients = await getWaitingPatients(db);

    res.render("dashboard", {
      user: req.session.user,
      waitingPatients
    });
  } catch (err) {
    console.error(err);
    res.send("Datenbankfehler");
  }
}

module.exports = {
  showDashboard
};
