2017-08-07 01:05:10 +00:00
|
|
|
|
2018-03-05 20:49:36 +00:00
|
|
|
/* global WIKI */
|
2017-08-07 01:05:10 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2017-08-09 02:36:29 +00:00
|
|
|
Query: {
|
|
|
|
users(obj, args, context, info) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.User.findAll({ where: args })
|
2017-08-09 02:36:29 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Mutation: {
|
|
|
|
createUser(obj, args) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.User.create(args)
|
2017-08-14 00:33:06 +00:00
|
|
|
},
|
|
|
|
deleteUser(obj, args) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.User.destroy({
|
2017-08-14 00:33:06 +00:00
|
|
|
where: {
|
|
|
|
id: args.id
|
|
|
|
},
|
|
|
|
limit: 1
|
|
|
|
})
|
2017-08-20 02:51:25 +00:00
|
|
|
},
|
|
|
|
modifyUser(obj, args) {
|
2018-03-05 20:49:36 +00:00
|
|
|
return WIKI.db.User.update({
|
2017-08-20 02:51:25 +00:00
|
|
|
email: args.email,
|
|
|
|
name: args.name,
|
|
|
|
provider: args.provider,
|
|
|
|
providerId: args.providerId,
|
|
|
|
role: args.role
|
|
|
|
}, {
|
|
|
|
where: { id: args.id }
|
|
|
|
})
|
|
|
|
},
|
|
|
|
resetUserPassword(obj, args) {
|
|
|
|
return false
|
|
|
|
},
|
|
|
|
setUserPassword(obj, args) {
|
|
|
|
return false
|
2017-08-09 02:36:29 +00:00
|
|
|
}
|
2017-08-07 01:05:10 +00:00
|
|
|
},
|
2017-08-09 02:36:29 +00:00
|
|
|
User: {
|
2017-08-07 01:05:10 +00:00
|
|
|
groups(usr) {
|
|
|
|
return usr.getGroups()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|