mirror of
https://github.com/wassname/talk.git
synced 2026-07-13 17:45:56 +08:00
25 lines
523 B
JavaScript
25 lines
523 B
JavaScript
const express = require('express');
|
|
const Setting = require('../../../models/setting');
|
|
const _ = require('lodash');
|
|
|
|
const router = express.Router();
|
|
|
|
router.get('/', (req, res, next) => {
|
|
Setting
|
|
.getSettings()
|
|
.then(settings => {
|
|
const whitelist = ['moderation'];
|
|
res.json(_.pick(settings, whitelist));
|
|
})
|
|
.catch(next);
|
|
});
|
|
|
|
router.put('/', (req, res, next) => {
|
|
Setting
|
|
.updateSettings(req.body)
|
|
.then(() => res.status(204).end())
|
|
.catch(next);
|
|
});
|
|
|
|
module.exports = router;
|