diff --git a/core/graphene/object_types.py b/core/graphene/object_types.py index 75a4c964..ea9bad4e 100644 --- a/core/graphene/object_types.py +++ b/core/graphene/object_types.py @@ -1,5 +1,5 @@ from django.core.cache import cache -from django.db.models import Max, Min +from django.db.models import Max, Min, QuerySet from django.db.models.functions import Length from django.utils.translation import gettext_lazy as _ from graphene import ( @@ -336,20 +336,22 @@ class OrderType(DjangoObjectType): ) description = _("orders") - def resolve_total_price(self, _info): + def resolve_total_price(self: Order, _info): return self.total_price - def resolve_total_quantity(self, _info): + def resolve_total_quantity(self: Order, _info): return self.total_quantity - def resolve_notifications(self, _info): + def resolve_notifications(self: Order, _info): return camelize(self.notifications) - def resolve_attributes(self, _info): + def resolve_attributes(self: Order, _info): return camelize(self.attributes) - def resolve_payments_transactions(self, _info) -> None | Transaction: - return None or self.payments_transactions + def resolve_payments_transactions(self: Order, _info) -> QuerySet[Transaction] | None: + if self.payments_transactions: + return self.payments_transactions.all() + return None class ProductImageType(DjangoObjectType):