I have a graphql query like the following one. As you can see, I have a variable defined activityCategory which is of type array of strings. That filter is populated by a multiselect dropdown on the UI which will have options like All, category1, category2 etc. So when All is selected we would send empty array [] to the filter which will return all the categories records. Or what ever were selected by the user for eg: [category1, category2], which then will return only the selected category records only.
gql`
query searchActivities(
$activityCategory: [String]
) {
expert {
engagement {
getActivities(
searchQuery: {
activityCategory: $activityCategory
}
) {
activities {
activityId
activityCategory
createdDate
action
}
}
}
}
}
`;
Now, we have added one more category to the categories enum let`s say category3 which wouldn't be part of the UI multiselect filter. Also, the behaviour should be like if the option All is selected, it means give all categories records except this newly added category3. And if user selects few categories from the dropdown it'll behave in the same way it used to, an array of user selected values would be sent in the filter and only those will be received.
In short, for the variable activityCategory from the above query, the value would be either activityCategory: {ne: "category3"} or activityCategory: ["category1", "category2"]. How does the above query change in this case? What type would I define for the query variable activityCategory instead of [String]?