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:
parent
351b4eda00
commit
07d32de16b
1 changed files with 27 additions and 27 deletions
|
|
@ -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"))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue