does anyone have a pagination example with nestjs ...
# orm-help
n
does anyone have a pagination example with nestjs + graphql that also returns count
a
in Prisma, I've wound up having to make two queries with the same filters inside of a transaction. The first gets the count, the second includes the pagination details and gets the selected details
winds up looking like
const [total, users] = await prisma.$transaction([
prisma.user.count({
where: // your where stuff
}),
prisma.user.findMany({
where: // your where stuff
skip: // skip details
take: // 10 or whatever
})
]);
n
how did you return that to edge/nodes @Austin Zentz (thanks for the reply btw)
a
ah, i don't have the gql constraint in my example -- that just gets returned in a REST-style API call
so hopefully that's a good 1st piece of the puzzle but doesn't solve the latter part
n
ah, yeah that's the issue i'm having is returning it as a edge and node also, but the full lifecycle of it