Using a GraphCool backend, is there a way to have conditional filter in a query?
let's say I have a query like this:
query ($first: Int, $skip: Int, $favorited: Boolean) {
allPhotos (
first: $first
skip: $skip
filter: {
favorited: $favorited
}
)
{
id
url
title
favorited
}
}
//variables: { "first": 10, "skip", "favorited": true }
The query above would either:
1) Fetch only photos that are favorited.
2) Fetch only photos that are not favorited.
My problem is I want to be able to either:
1) query photos that are ONLY either favorited OR not favorited.
2) query photos regardless of whether or not they're favorited.
How do I conditionally include filters? Can I? I'm doing something with react-apollo in Javascript and I could figure out a solution with code, but I was wondering if there was a way to do it in graphql land.