mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
22 lines
644 B
JavaScript
22 lines
644 B
JavaScript
import bcrypt from 'bcryptjs'
|
|
import walkRecursive from '../helpers/walkRecursive'
|
|
|
|
export default {
|
|
Mutation: {
|
|
CreateUser: async (resolve, root, args, context, info) => {
|
|
args.password = await bcrypt.hashSync(args.password, 10)
|
|
const result = await resolve(root, args, context, info)
|
|
result.password = '*****'
|
|
return result
|
|
}
|
|
},
|
|
Query: async (resolve, root, args, context, info) => {
|
|
let result = await resolve(root, args, context, info)
|
|
result = walkRecursive(result, ['password', 'privatKey'], () => {
|
|
// replace password with asterisk
|
|
return '*****'
|
|
})
|
|
return result
|
|
}
|
|
}
|