createUser: async args => {
const existingUser = await User.findOne({ email: args.userInput.email });
throw new Error('email already registered.');
const hashedPassword = await bcrypt.hash(args.userInput.password, 12);
const picture = args.userInput.picture ? saveImageToDisk(args.userInput.picture) : ''
email: args.userInput.email,
password: hashedPassword,
phone: args.userInput.phone,
name: args.userInput.name,
const result = await user.save();
sendEmail(result.email, 'Account Creation', signupText, signupTemplate);
{ userId: result.id, email: result.email },
console.log({ ...result._doc, userId: result.id, token: token, tokenExpiration: 1 })
return { ...result._doc, userId: result.id, token: token, tokenExpiration: 1 };