Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Last active August 14, 2020 11:34
Show Gist options
  • Save velotiotech/8afe05bc5bda00af40ebbd3699376766 to your computer and use it in GitHub Desktop.
Save velotiotech/8afe05bc5bda00af40ebbd3699376766 to your computer and use it in GitHub Desktop.
function post(parent, args, context, info) {
const userId = getUserId(context)
const newLink = await context.prisma.link.create({
data: {
url: args.url,
description: args.description,
postedBy: { connect: { id: userId } },
}
})
context.pubsub.publish("NEW_LINK", newLink)
return newLink
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment