Hey everybody somebody know how can ignore a field...
# random
m
Hey everybody somebody know how can ignore a field if $variable is null for this
Copy code
query filterCourses(
        $hourStartMin: Int, $hourStartMax: Int, $hourEndMin: Int, $hourEndMax: Int, $date: String, $locationEnd: String, $locationStart: String){
        allCourses(
            filter: {
                status: OPEN,
                hourStart_gte: $hourStartMin,
                hourStart_lte: $hourStartMax,
                hourEnd_gte: $hourEndMin,
                hourEnd_lte: $hourEndMax,
                date: $date,
                locationEnd: { name: $locationEnd },
                locationStart: { city: $locationStart }
            }
        ){
        ..node..
    }
m
I know you
j
You could combine all filters into $filters var object and use like: allCourses(filter: $filter) {} then just don’t pass in nulls to the filter object.
r
You could use a directive (@skip/@include)