Ibad Shaikh
09/18/2021, 8:51 PMconst result = prismaOffsetPagination({
model: User, // How to access prisma model like in this example.
cursor: <cursor>,
size: 5,
buttonNum: 7,
orderBy: 'id',
orderDirection: 'desc',
where: {
email: {
contains: 'smallbee',
},
},
prisma: prisma,
});
Check Line:2Jakub Hrášek
09/19/2021, 7:47 AMimport { User } from '@prisma/client'?
See the code
https://github.com/prisma-korea/prisma-offset-pagination/blob/master/src/paginator/pageEdge.ts#L77Ibad Shaikh
09/20/2021, 9:15 AMIbad Shaikh
09/20/2021, 1:59 PMRyan
09/20/2021, 2:03 PMconst result = prismaOffsetPagination({
model: 'User',
cursor: <cursor>,
size: 5,
buttonNum: 7,
orderBy: 'id',
orderDirection: 'desc',
where: {
email: {
contains: 'smallbee',
},
},
prisma: prisma,
});Ryan
09/20/2021, 2:03 PMIbad Shaikh
09/20/2021, 2:11 PMIbad Shaikh
09/20/2021, 2:11 PMRyan
09/20/2021, 2:13 PM'User'Ibad Shaikh
09/20/2021, 2:16 PMRyan
09/20/2021, 2:30 PMconst result = await prismaOffsetPagination({
model: { name: 'Post' },
size: 5,
orderBy: 'id',
orderDirection: 'desc',
prisma,
})Ibad Shaikh
09/20/2021, 5:14 PMprisma.post.aggregate() invocation:
Failed to validate the query: Field does not exist on enclosing type. at Query.aggregatepost.AggregatePost._countIbad Shaikh
09/20/2021, 5:19 PMIbad Shaikh
09/24/2021, 11:20 PMRyan
09/27/2021, 6:28 AM