{"size": 1260, "ext": "js", "max_stars_repo_path": "routes/schedulePrint.js", "max_stars_repo_name": "ckxng/universityofscouting", "max_stars_repo_stars_event_min_datetime": "2021-01-10T00:55:54.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-10T00:55:54.000Z", "max_issues_repo_path": "routes/schedulePrint.js", "max_issues_repo_name": "ckxng/universityofscouting", "max_issues_repo_issues_event_min_datetime": "2020-06-12T18:24:02.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-25T17:14:48.000Z", "max_forks_repo_path": "routes/schedulePrint.js", "max_forks_repo_name": "ckxng/universityofscouting", "max_forks_repo_forks_event_min_datetime": "2020-08-24T03:08:56.000Z", "max_forks_repo_forks_event_max_datetime": "2020-08-24T04:23:44.000Z"}
{"max_stars_count": 1, "max_issues_count": 3, "max_forks_count": 2, "avg_line_length": 28.6363636364, "max_line_length": 75, "alphanum_fraction": 0.6515873016}
/**
 * schedule router module
 *
 * This module displays schedules for logged in users in a print window
 *
 * @module routes/schedulePrint
 */
// jshint esversion: 8
// async functions
var express = require("express");
var router = express.Router();
var modelhelper = require("../lib/modelhelper");

/**
 * GET schedule print page
 *
 * @private
 * @memberof module:routes/schedulePrint
 * @param {Object}   req                request object
 * @param {Object}   req.user           the currently logged in user
 * @param {String}   req.user.memberID  the memberID of the logged in user
 * @param {String}   req.user.councilID the councilID of the logged in user
 * @param {Object}   res                response object
 * @param {Function} next               function call to next middleware
 */
async function routerGETSchedule(req, res, next) {
  try {
    res.render("schedulePrint", {
      schedule: await modelhelper.getRegistration({
        memberID: req.user.memberID,
        councilID: req.user.councilID
      }),
      user: req.user,
      title: "Print Schedule",
    });
  } catch (err) {
    res.status(500).json({message: err.message});
  }
}

// register routes and export router
router.get("/", routerGETSchedule);
module.exports = router;
