(parent, args, context, info)
| 18 | } |
| 19 | |
| 20 | async function signup(parent, args, context, info) { |
| 21 | const password = await bcrypt.hash(args.password, 10); |
| 22 | const user = await context.prisma.user.create({ |
| 23 | data: { ...args, password } |
| 24 | }); |
| 25 | |
| 26 | const token = jwt.sign({ userId: user.id }, APP_SECRET); |
| 27 | |
| 28 | return { |
| 29 | token, |
| 30 | user |
| 31 | }; |
| 32 | } |
| 33 | |
| 34 | async function login(parent, args, context, info) { |
| 35 | const user = await context.prisma.user.findUnique({ |