Features: 1) Add AddressType class above FeedbackType for organizational clarity;

Fixes: 1) Resolve duplicate declaration of AddressType by removing the redundant implementation;

Extra: Reorder and clean up code to improve structure and maintainability;
This commit is contained in:
Egor Pavlovich Gorbunov 2025-05-20 08:18:35 +03:00
parent 351b4eda00
commit 07d32de16b

View file

@ -209,6 +209,33 @@ class VendorType(DjangoObjectType):
description = _("vendors")
class AddressType(DjangoObjectType):
latitude = Float(description=_("Latitude (Y coordinate)"))
longitude = Float(description=_("Longitude (X coordinate)"))
class Meta:
model = Address
fields = (
"uuid",
"street",
"district",
"city",
"region",
"postal_code",
"country",
"raw_data",
"api_response",
"user",
)
read_only_fields = ("api_response",)
def resolve_latitude(self, info):
return self.location.y if self.location else None
def resolve_longitude(self, info):
return self.location.x if self.location else None
class FeedbackType(DjangoObjectType):
comment = String(description=_("comment"))
rating = Int(description=_("rating value from 1 to 10, inclusive, or 0 if not set."))
@ -359,33 +386,6 @@ class ProductType(DjangoObjectType):
return self.quantity or 0
class AddressType(DjangoObjectType):
latitude = Float(description=_("Latitude (Y coordinate)"))
longitude = Float(description=_("Longitude (X coordinate)"))
class Meta:
model = Address
fields = (
"uuid",
"street",
"district",
"city",
"region",
"postal_code",
"country",
"raw_data",
"api_response",
"user",
)
read_only_fields = ("api_response",)
def resolve_latitude(self, info):
return self.location.y if self.location else None
def resolve_longitude(self, info):
return self.location.x if self.location else None
class AttributeValueType(DjangoObjectType):
value = String(description=_("attribute value"))