Skip to content

Commit

Permalink
feat: fw-level pagination strategy setting
Browse files Browse the repository at this point in the history
Thanks to @houfio
  • Loading branch information
jasonkuhrt committed Jun 30, 2020
1 parent abc4480 commit a442ccd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/framework/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const plugin: RuntimePlugin<Settings> = (settings) => (project) => {
plugins: [
nexusSchemaPrisma({
experimentalCRUD: settings?.features?.crud ?? false,
paginationStrategy: settings?.paginationStrategy ?? 'relay',
inputs: {
prismaClient: prismaClientDir,
},
Expand Down
11 changes: 11 additions & 0 deletions src/framework/settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PrismaClient } from '@prisma/client'
import { PrismaClientOptions as ClientOptions } from '@prisma/client/runtime/getPrismaClient'
import { Options as NexusSchemaPrismaOptions } from '../schema'

export type PrismaClientOptions = {
/**
Expand Down Expand Up @@ -40,4 +41,14 @@ export type Settings = {
*/
crud?: boolean
}
/**
* Select the pagination strategy.
*
* 'prisma' strategy results in GraphQL pagination arguments mirroring those of Prisma: skip, cursor, take
*
* 'relay' strategy results in GraphQL pagination arguments matching those of the [GraphQL Relay specification](https://relay.dev/graphql/connections.htm): before, after, first, last.
*
* @default 'relay'
*/
paginationStrategy?: NexusSchemaPrismaOptions['paginationStrategy']
}

0 comments on commit a442ccd

Please sign in to comment.