added collection and allowed to settings

This commit is contained in:
Ritchie Martori
2011-11-19 22:04:20 -08:00
parent 93946e99e8
commit d4dafe6127
2 changed files with 30 additions and 22 deletions

View File

@@ -13,6 +13,17 @@ app.get('/settings', function(req, res) {
;
});
app.post('/settings', function(req, res) {
Settings
.spawn()
.for(req)
.find({name: req.body.name, plugin: req.body.name})
.set(req.body)
.notify(res)
.save()
;
});
app.get('/settings/:name', function(req, res) {
Setting
.spawn()
@@ -23,19 +34,11 @@ app.get('/settings/:name', function(req, res) {
;
});
var Model = require('../../model').spawn();
Model.unlock();
Model.collection = 'system.indexes';
Model.notify(function(data) {
config.indexes = data;
Setting
.spawn()
.find({name: 'app'})
.set(config)
.set({name: 'app'})
.save()
;
}).fetch();
// create or update app settings
// create or update general app settings
Setting
.spawn()
.find({name: 'app'})
.set(config)
.set({name: 'app'})
.save()
;