We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi all! I'm using pothos and prisma, have some similar crud operations and want to create some generic method for it. But I'm stuck with types.
For example - I have method to querying list.
builder.queryField('groups', (t) => t.prismaField({ type: ['Group'], args: { ...createSorterAndFilterArgs(t.arg) }, resolve: async (query, _parent, _args, _ctx, _info) => { const { sorter, filter } = _args return await prisma.group.findMany({ ...query, orderBy: applySorting(sorter), where: { name: !!filter?.searchString ? { contains: filter.searchString, mode: 'insensitive' } : undefined } }) } }) )
When I'm trying to pass parameter for "type" - there is a trouble with type for "query" param in "resolve" method.
type Options = { queryName: string type: [keyof PrismaTypes] } const common = ({ queryName, type }: Options) => { builder.queryField(queryName, (t) => t.prismaField({ type: type, args: { ...createSorterAndFilterArgs(t.arg) }, resolve: async (query, _parent, _args, _ctx, _info) => { const { sorter, filter } = _args return await prisma.group.findMany({ ...query, orderBy: applySorting(sorter), where: { name: !!filter?.searchString ? { contains: filter.searchString, mode: 'insensitive' } : undefined } }) } }) ) } common({ queryName: 'groups', type: ['Group'] })
I tried different types to pass as parameter, but cannot resolve this problem. Could you help me with it plz?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi all!
I'm using pothos and prisma, have some similar crud operations and want to create some generic method for it. But I'm stuck with types.
For example - I have method to querying list.
When I'm trying to pass parameter for "type" - there is a trouble with type for "query" param in "resolve" method.
I tried different types to pass as parameter, but cannot resolve this problem. Could you help me with it plz?
The text was updated successfully, but these errors were encountered: