Skip to content

Instantly share code, notes, and snippets.

@gc-codesnippets
Created November 30, 2018 22:58
Show Gist options
  • Save gc-codesnippets/520f62428cbb696776a1a9a3b39f4ee2 to your computer and use it in GitHub Desktop.
Save gc-codesnippets/520f62428cbb696776a1a9a3b39f4ee2 to your computer and use it in GitHub Desktop.
import { idArg } from 'gqliteral'
import { prismaObjectType } from '../../../plugin'
import { prisma } from '../../generated/prisma-client'
export const Query = prismaObjectType('Query', t => {
t.prismaFields(['products', 'options', 'brands'])
t.field('otherProduct', 'Product', {
args: { id: idArg({ required: true }) },
resolve: (parent, { id }) => prisma.product({ id }),
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment