2017-08-20 02:51:25 +00:00
|
|
|
|
2018-03-05 20:49:36 +00:00
|
|
|
/* global WIKI */
|
2017-08-20 02:51:25 +00:00
|
|
|
|
|
|
|
const _ = require('lodash')
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
Query: {
|
|
|
|
settings(obj, args, context, info) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.Setting.findAll({ where: args, raw: true }).then(entries => {
|
2017-08-20 02:51:25 +00:00
|
|
|
return _.map(entries, entry => {
|
|
|
|
entry.config = JSON.stringify(entry.config)
|
|
|
|
return entry
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Mutation: {
|
|
|
|
setConfigEntry(obj, args) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.Setting.update({
|
2017-08-20 02:51:25 +00:00
|
|
|
value: args.value
|
|
|
|
}, { where: { key: args.key } })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|