Skip to content

Instantly share code, notes, and snippets.

@dtauer
Created June 26, 2024 19:16
Show Gist options
  • Save dtauer/c87006293556de6d3a03f3627fb17b48 to your computer and use it in GitHub Desktop.
Save dtauer/c87006293556de6d3a03f3627fb17b48 to your computer and use it in GitHub Desktop.
Mutation: {
editIssue: async (_, { input }, ctx) => {
if (!ctx.user)
throw new GraphQLError('UNAUTHORIZED', { extensions: { code: 401 } })
const { id, ...update } = input
const result = await db
.update(issues)
.set(update ?? {})
.where(and(eq(issues.userid, ctx.urser.id), eq(issues.id, id)))
.returning()
return result[0]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment