Unverified Commit fe09ad9f authored by Mark Stenglein's avatar Mark Stenglein
Browse files

Finish initial models, and fix broken configs for routes

Next up will be getting the database to sync and etc
- :ocelotsloth:
parent 6cf40c8a
...@@ -13,7 +13,7 @@ var logger = require('morgan'); ...@@ -13,7 +13,7 @@ var logger = require('morgan');
var cookieParser = require('cookie-parser'); var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser'); var bodyParser = require('body-parser');
var Sequelize = require('sequelize'); var Sequelize = require('sequelize');
var config = require('config'); //var config = require('config');
// Load in Routes // Load in Routes
// TODO: Make this a dynamic loading system that simply scans the directory // TODO: Make this a dynamic loading system that simply scans the directory
...@@ -42,7 +42,7 @@ app.use(require('node-sass-middleware')({ ...@@ -42,7 +42,7 @@ app.use(require('node-sass-middleware')({
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public')));
// Initialize the Database and Connection // Initialize the Database and Connection
var db = require(path.join(__dirname, 'models', 'index')); app.set('db', path.join(__dirname, 'models', 'index'));
// Populate initial data // Populate initial data
// TODO: populate the information // TODO: populate the information
......
...@@ -41,3 +41,6 @@ schools : ...@@ -41,3 +41,6 @@ schools :
longName : "Spring 2017" longName : "Spring 2017"
dataFile : "GMU2017SP.min.json" dataFile : "GMU2017SP.min.json"
schoolSlugs :
- "GMU"
- "VT"
...@@ -8,9 +8,9 @@ module.exports = function(sequelize, DataTypes) { ...@@ -8,9 +8,9 @@ module.exports = function(sequelize, DataTypes) {
name: DataTypes.STRING, name: DataTypes.STRING,
universitySlug: { universitySlug: {
type: DataTypes type: DataTypes.STRING,
references: { references: {
model: University model: University,
key: slug key: slug
} }
} }
......
...@@ -4,21 +4,22 @@ ...@@ -4,21 +4,22 @@
// data source for the application sent on the front end. // data source for the application sent on the front end.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
var mongoose = require('mongoose'); var mongoose = require('mongoose');
var Semester = require('../../models/Semester'); var Semester = require('../../models/Semester');
var ical = require('ical-generator'); var ical = require('ical-generator');
var config = require('config');
// Load site wide configurations // Load site wide configurations
var config = require('../../config'); var schoolSlugs = config.get('schoolSlugs');
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// JSON API Section // JSON API Section
// Get school and semester slug listing // Get school and semester slug listing
router.get('/json/schools', function(req, res, next) { router.get('/json/schools', function(req, res, next) {
res.json(config.schoolSlugs); res.json(schoolSlugs);
}); });
// GET classes for a semester // GET classes for a semester
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
var config = require('config');
// Load site wide configurations // Load site wide configurations
var config = require('../config'); var siteInfo = config.get('general');
router.get('/', function(req, res, next) { router.get('/', function(req, res, next) {
res.render('docs', { config }); res.render('docs', { siteInfo });
}) })
module.exports = router; module.exports = router;
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
var config = require('config');
// Load site wide configurations // Load site wide configurations
var config = require('../config'); var siteInfo = config.get('general');
/* GET home page. */ /* GET home page. */
router.get('/', function(req, res, next) { router.get('/', function(req, res, next) {
res.render('index', { config }); res.render('index', { siteInfo });
}) })
module.exports = router; module.exports = router;
...@@ -4,7 +4,7 @@ var Semester = require('../models/Semester'); ...@@ -4,7 +4,7 @@ var Semester = require('../models/Semester');
var fs = require("fs"); var fs = require("fs");
// Load site wide configurations // Load site wide configurations
var config = require('../config'); //var config = require('../config');
var populateDB = function() { var populateDB = function() {
if (config.ReloadDB) { if (config.ReloadDB) {
......
...@@ -10,5 +10,5 @@ div.row.center-text ...@@ -10,5 +10,5 @@ div.row.center-text
i.fa.fa-circle-thin.fa-stack-2x(aria-hidden='true') i.fa.fa-circle-thin.fa-stack-2x(aria-hidden='true')
i.fa.fa-calendar.fa-stack-1x(aria-hidden='true') i.fa.fa-calendar.fa-stack-1x(aria-hidden='true')
// Title for the site // Title for the site
h1 #{config.siteName} h1 #{siteInfo.name}
small #{config.siteDescription} small #{siteInfo.description}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment