The following graphene query of mine where I pass parameters to my query returns all the results, even when my front end gives correct parameters it gives all results. Even with data where no result should return it still returns all results.
I have a graphene type:
class TimeStampType(DjangoObjectType):
rowid=graphene.Int()
class Meta:
model = TimeStamp
interfaces = (Node, )
filter_fields = {
'year': ['exact'],
'week': ['exact'],
'weekDay': ['exact'],
'shift': ['exact'],
'time': ['exact'],
'shortDate': ['exact'],
}
def resolve_rowid(self, context, **kwargs):
return self.id
with query:
node_timestamp = DjangoFilterConnectionField(TimeStampType)
My query looks like the following:
query nodeTimeStamp($year:Float, $week:Float, $weekDay:Float){
nodeTimestamp(year:$year, week:$week, weekDay:$weekDay) {
edges{
node{
id
rowid
}
}
}
}
What I figured out at the end of the day was that for some reason I should change my Apollo query from (don't know what example I saw that did it the first way, maybe some old docs)
.watchQuery({
variables: {$year:2018, $week:42, $weekDay:3},
query: gql`
and remove the $ signs so that it says:
.watchQuery({
variables: {year:2018, week:42, weekDay:3},
query: gql`
So basically I was sending variables through that did not exist so the query returned all the data.