Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add ancestors node in CategoryType
Marcin Gębala58634d62902b
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.pyindex d65addb3c3..0dd94ac889 100644--- a/saleor/graphql/api.py+++ b/saleor/graphql/api.py@@ -67,6 +67,7 @@ class CategoryType(DjangoObjectType):subcategories slugs to filter the products by""")))products_count = graphene.Int()url = graphene.String()+ ancestors = graphene.List(lambda: CategoryType)children = graphene.List(lambda: CategoryType)siblings = graphene.List(lambda: CategoryType)@@ -74,6 +75,9 @@ class CategoryType(DjangoObjectType):model = Categoryinterfaces = (relay.Node, DjangoPkInterface)+ def resolve_ancestors(self, args, context, info):+ return self.get_ancestors()+def resolve_children(self, args, context, info):return self.children.all()