(parent, args, context, info)
| 3 | const { APP_SECRET } = require('../utils'); |
| 4 | |
| 5 | async function post(parent, args, context, info) { |
| 6 | const { userId } = context; |
| 7 | |
| 8 | const newLink = await context.prisma.link.create({ |
| 9 | data: { |
| 10 | url: args.url, |
| 11 | description: args.description, |
| 12 | postedBy: { connect: { id: userId } } |
| 13 | } |
| 14 | }); |
| 15 | context.pubsub.publish('NEW_LINK', newLink); |
| 16 | |
| 17 | return newLink; |
| 18 | } |
| 19 | |
| 20 | async function signup(parent, args, context, info) { |
| 21 | const password = await bcrypt.hash(args.password, 10); |