I am switching to Prisma2 using nexus and cannot find a good way to implement pagination - a skip type will work fine. I could find a good way to implement it on the array, so what I ended up is added a computed field total on the type.
export const User = objectType({
name: 'User',
definition(t) {
t.model.id()
t.model.name()
...
t.field('total', {
type: 'Int',
resolve: async (parent, args, ctx, info) => {
let users = await ctx.photon.users.findMany()
return users.length
},
})
It's usable, but I am sure that there is a better way... can anyone give me a hint?