Updates to the website to remove Yaks and AP classes; Updates to the admin site to support user management (not working fully yet).

This commit is contained in:
Wynne Crisman
2016-07-20 15:11:55 -07:00
parent 83a831736a
commit 3340dc7e34
30 changed files with 1400 additions and 1666 deletions

View File

@@ -94,7 +94,7 @@ module.exports = function(app, rootPath, passport, smtpTransport, sequelize) {
});
}
else {
console.log("Looking for index.ejs in " + adminPath);
//console.log("Looking for index.ejs in " + adminPath);
//res.render("index.ejs", {root: adminPath});
res.render(path.join(adminPath, req.baseUrl, "index"));
}
@@ -181,6 +181,26 @@ module.exports = function(app, rootPath, passport, smtpTransport, sequelize) {
}
});
});
app.get('/admin/user-data', isLoggedIn, function(req, res) {
try {
if(req.user.admin) {
sequelize.models.User.findAll().then(function(values) {
res.json(values);
});
}
else {
}
}
catch(e) {console.log(e);}
});
app.post('/admin/createUser', isLoggedIn, function(req, res) {
try {
res.json({status: 'success'});
} catch(e) {console.log(e);}
});
app.get('/admin/getCategories', isLoggedIn, function(req, res) {
sequelize.models.Category.findAll({attributes: ['id', 'name', 'visible'], order: [['name', 'DESC'], ['visible', 'DESC']]}).then(function(values) {