From 34f25052e0a51f83758d9906e5a09ac1f0812e78 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Sun, 6 Jul 2025 23:34:43 +0300 Subject: [PATCH] Features: 1) Update type annotations in resolver methods for clarity and type safety; Fixes: 1) Ensure accurate return types in resolver methods to avoid potential runtime issues; Extra: 1) Minor code consistency improvements in `object_types.py`; --- core/graphene/object_types.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/graphene/object_types.py b/core/graphene/object_types.py index ea9bad4e..c93c0aef 100644 --- a/core/graphene/object_types.py +++ b/core/graphene/object_types.py @@ -396,7 +396,7 @@ class ProductType(DjangoObjectType): filter_fields = ["uuid", "name"] description = _("products") - def resolve_price(self, _info) -> float: + def resolve_price(self: Product, _info) -> float: return self.price or 0.0 def resolve_feedbacks(self: Product, _info): @@ -404,7 +404,7 @@ class ProductType(DjangoObjectType): return Feedback.objects.filter(order_product__product=self) return Feedback.objects.filter(order_product__product=self, is_active=True) - def resolve_feedbacks_count(self, _info) -> int: + def resolve_feedbacks_count(self: Product, _info) -> int: return self.feedbacks_count or 0 def resolve_attribute_groups(self: Product, info): @@ -412,7 +412,7 @@ class ProductType(DjangoObjectType): return AttributeGroup.objects.filter(attributes__values__product=self).distinct() - def resolve_quantity(self, _info) -> int: + def resolve_quantity(self: Product, _info) -> int: return self.quantity or 0