Open he0119 opened 1 year ago
Hey @he0119 ,
I don't think we are considering this corner case yet... I might try to take a look at that in the future.
In the mean time you can do the following:
from strawberry_django.ordering import apply as apply_order
from strawberry_django.filters import apply as apply_filters
class Device(relay.Node):
...
@gql.django.connection(
gql.django.ListConnectionWithTotalCount[AutowateringData],
)
def autowatering_data(
self,
info,
filters: AutowateringDataFilter | None = UNSET,
order: AutowateringDataOrder | None = UNSET,
) -> Iterable[models.AutowateringData]:
qs = models.AutowateringData.objects.all()
if filters is not UNSET:
qs = apply_filters(qs, info=info)
if order is not UNSET:
qs = apply_ordering(qs)
return qs
Thanks, it works now.
Argument filters shows up in GraphiQL, but still got an error. It works fine before upgrading to v3.
Related code: https://github.com/he0119/smart-home/commit/9922c788a2d79761bd6c100c3bd4b13c31cfb4d6#diff-af3602ede1befa32df28d961add5b48aaf07992465fb6d0f1dbb50e4a0568cdbR79-R85