mirror of
https://github.com/wassname/talk.git
synced 2026-08-16 11:29:31 +08:00
Add hooks to RootMutation to save our setting in the database.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { readFileSync } = require('fs');
|
||||
const path = require('path');
|
||||
const hooks = require('./server/hooks');
|
||||
const resolvers = require('./server/resolvers');
|
||||
|
||||
module.exports = {
|
||||
@@ -7,5 +8,6 @@ module.exports = {
|
||||
path.join(__dirname, 'server/typeDefs.graphql'),
|
||||
'utf8'
|
||||
),
|
||||
hooks,
|
||||
resolvers,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
RootMutation: {
|
||||
updateSettings: {
|
||||
async pre(_, { input }) {
|
||||
input.metadata = {
|
||||
...input.metadata,
|
||||
globalSwitchoffEnable: input.globalSwitchoffEnable,
|
||||
};
|
||||
delete input.globalSwitchoffEnable;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user