start adding mail settings

This commit is contained in:
Riley Davis
2016-11-14 10:44:33 -07:00
parent fad0122960
commit 7d9b24c5b9
3 changed files with 16 additions and 2 deletions
+9 -1
View File
@@ -1,9 +1,17 @@
const mongoose = require('../mongoose');
const Schema = mongoose.Schema;
/**
* this Schema manages application settings that get used on front- and backend
* NOTE: when you set a setting here, it will not automatically be exposed to
* the front end. You must add it to the whitelist in the settings route
* in /routes/api/settings/index.js
* @type {Schema}
*/
const SettingSchema = new Schema({
id: {type: String, default: '1'},
moderation: {type: String, enum: ['pre', 'post'], default: 'pre'}
moderation: {type: String, enum: ['pre', 'post'], default: 'pre'},
smtp_connection_string: {type: String, default: ''},
}, {
timestamps: {
createdAt: 'created_at',
+2
View File
@@ -51,8 +51,10 @@
"debug": "^2.2.0",
"ejs": "^2.5.2",
"express": "^4.14.0",
"lodash": "^4.16.6",
"mongoose": "^4.6.5",
"morgan": "^1.7.0",
"nodemailer": "^2.6.4",
"prompt": "^1.0.0",
"uuid": "^2.0.3"
},
+5 -1
View File
@@ -1,3 +1,4 @@
const _ = require('lodash');
const express = require('express');
const router = express.Router();
const Setting = require('../../../models/setting');
@@ -5,7 +6,10 @@ const Setting = require('../../../models/setting');
router.get('/', (req, res, next) => {
Setting
.getSettings()
.then(settings => res.json(settings))
.then(settings => {
const whitelist = ['moderation'];
res.json(_.pick(settings, whitelist));
})
.catch(next);
});