mirror of https://github.com/Requarks/wiki.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
875 B
41 lines
875 B
"use strict";
|
|
|
|
var express = require('express');
|
|
var router = express.Router();
|
|
const Promise = require('bluebird');
|
|
|
|
/**
|
|
* Admin
|
|
*/
|
|
router.get('/', (req, res) => {
|
|
res.redirect('/admin/profile');
|
|
});
|
|
|
|
router.get('/profile', (req, res) => {
|
|
res.render('pages/admin/profile', { adminTab: 'profile' });
|
|
});
|
|
|
|
router.get('/stats', (req, res) => {
|
|
Promise.all([
|
|
db.Entry.count(),
|
|
db.UplFile.count(),
|
|
db.User.count()
|
|
]).spread((totalEntries, totalUploads, totalUsers) => {
|
|
return res.render('pages/admin/stats', {
|
|
totalEntries, totalUploads, totalUsers,
|
|
adminTab: 'stats'
|
|
}) || true;
|
|
}).catch((err) => {
|
|
throw err;
|
|
});
|
|
});
|
|
|
|
router.get('/users', (req, res) => {
|
|
res.render('pages/admin/users', { adminTab: 'users' });
|
|
});
|
|
|
|
router.get('/settings', (req, res) => {
|
|
res.render('pages/admin/settings', { adminTab: 'settings' });
|
|
});
|
|
|
|
module.exports = router;
|