I have this query
query restrictionsTrav($match: String, $offset: Int, $stateIds: [Int!]) {
destinations_for_travel(limit: 100, offset: $offset, where: {city_name: {name: {_ilike: $match}, province_name: {state_Name: {id: {_in: $stateIds}}}}}) {
is_Travel_Allowed
city_status {
name
status
}
city_name{
name
province_name{
name
key
state_Name{
name
long_name
key
}
}
}
updated_at
}
}
Basically, when I query it on Hasura, I have the following query variables: match, offset, and stateIds.
What I want to happen is that even if I leave stateIds empty, I will still see results that match city_name which is represented by the variable match. I tried removing the ! from stateIds but I get an error:
Variable "$stateIds" of type "[Int]" used in position expecting type "[Int!]"
Is there a way wherein I can make the stateIds optional? With the query above, nothing displays if there are no values inside the array stateIds.