System Information
- Strapi Version: 4.1.7
- Database: PostgreSQL
I have a Content Type called Question, it has a relation with Content Type called Answer (question has many answers). Here’s how I retrieve it:
query Questions($locale:I18NLocaleCode) {
questions(locale: $locale) {
data {
id
attributes {
text
answers {
data {
id
createdAt
attributes {
text
createdAt
user {
...user info
}
}
}
}
}
}
}
}
So it brings all the questions with all the answers to each question.
However, now I want to pass some filter argument to the query to retrieve only question that have no answers (later I want to add more filters). I didn’t find a way to do it with Strapi GraphQL API. Is it possible? And if yes - how? Or do I still have to retrieve all the questions and then filter them on the client side (very undesirable behavior)? Or perhaps write some custom route with custom handler and pass the filters in the request? But then again, not sure how to do it with Entity Service API or Query Engine API…