Jonathan
12/03/2020, 11:44 PMusersPagination(filter: { search, count, sort }) {
users {
username
email
etc
}
pageInfo {
count
pageIndex
}
postsPagination(filterForParent: {search, startDate }) <- another filter {
posts {
pages
}
pageInfo {
count
pageIndex
}
}
}
In theory, we are trying to see if it is possible to define some filter on a child, and use that filter in the parent? So that we can define for instance
"Give me 10 users, who contain search, or if their posts contain search. Just give me 10 in total" Any clean API's that do something like this?Ryan
12/04/2020, 8:20 AMGive me 10 users, who containYou would need to implement a custom resolver with a query like this:, or if their posts containsearch.search
prisma.user.findMany({
where: {
OR: [
{ name: { contains: 'search' } },
{ posts: { some: { title: { contains: 'search' } } } },
],
},
take: 10,
})Jonathan
12/04/2020, 8:24 AMJonathan
12/04/2020, 8:25 AMRyan
12/04/2020, 8:34 AMinfo argument. You can easily fetch for the filter attributes and add them to the query dynamically 🙂Jonathan
12/04/2020, 8:39 AM