class ProductQuery(graphene.ObjectType):
    products = graphene.List(Product)
    def resolve_products(self, info):
        return get_all_products()
Above are my code for query all product with no param. What is I want to query product by manufacture_id? How to do I do the resolver?
There is no document on their official site.
class ProductQuery(graphene.ObjectType):
  products = graphene.List(Product, id=graphene.Int())
  def resolve_products(self, info, id):
    return Product.objects.filter_by(manufacture_id__exact=id)
You have to add the parameter you want to query by.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With