✨ UserDetail and UserList views

This commit is contained in:
Nikolai R Kristiansen committed 2022-02-12 12:58:04 +01:00
1 parent ec0549154d
commit e2a84c25a6
16 files changed
+201 -22

No files matched your search

+11 -2
View File
@@ -36,15 +36,24 @@ class Product:
user_counts: JSONScalar
@strawberry.type
class TopMonth:
period: str
count: int
sum: int
@strawberry_django.type(models.UserProfile)
class UserProfile:
id: auto
balance: auto
image: auto
last_purchase_date: datetime
order_sum_total: float
@strawberry.field()
def last_purchase_date(self) -> datetime:
return self.last_purchase_date()
def top_months(self) -> list[TopMonth]:
return [TopMonth(**month) for month in self.top_months()]
@strawberry_django.type(UserModel)