Reputation: 79
Description: I have a seeProfile resolver, which gives back a profile of a particular user. This user has a photos array and I want to paginate these photos and I can't figure out how. I have a workaround but I'd like to know a way - shall it exist - to paginate a field of this one user.
Workaround: I can simply make a resolver for fetching pictures for a particular user with .findMany() and paginate them with take: and skip: . But then I make two queries instead of one. So, if anyone knows a way to paginate the photos inside findUnique query, please let me know, thanks!
Upvotes: 2
Views: 560
Reputation: 7278
Unfortunately, there's no way as of now to implement pagination inside the include
relation in Prisma.
You will have to make two separate queries with Prisma, as you described in your workaround:
findUnique
query to fetch the user
records.findMany
query to fetch the approrpriate photo
records.I can simply make a resolver for fetching pictures for a particular user.
Perhaps it just makes sense to do both queries in the same resolver, to avoid two requests to the API.
Upvotes: 2