|
@@ -9,10 +9,7 @@ const Query = {
|
|
|
trainings: forwardTo('db'),
|
|
|
me: (parent, args, context, info) => {
|
|
|
if (!context.request.userId) throw new Error('Not logged in.')
|
|
|
- return context.db.query.user(
|
|
|
- { where: { id: context.request.userId } },
|
|
|
- info
|
|
|
- )
|
|
|
+ return context.db.query.user({ where: { id: context.request.userId } }, info)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -39,14 +36,14 @@ const Mutation = {
|
|
|
return user
|
|
|
},
|
|
|
signup: async (parent, args, ctx, info) => {
|
|
|
- args.email = args.email.toLowerCase()
|
|
|
+ const email = args.email.toLowerCase()
|
|
|
const password = await bcrypt.hash(args.password, 10)
|
|
|
const user = await ctx.db.mutation.createUser(
|
|
|
{
|
|
|
data: {
|
|
|
...args,
|
|
|
- password,
|
|
|
- permissions: { set: ['USER'] }
|
|
|
+ email,
|
|
|
+ password
|
|
|
}
|
|
|
},
|
|
|
info
|