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`;
This commit is contained in:
parent
07aadb5d83
commit
34f25052e0
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue