✨ Add stats for all purchases over time
This commit is contained in:
1 parent
7474885f14
commit
6f6fbc648c
10 files changed
+119
-32
No files matched your search
+13
-2
@@ -3,7 +3,6 @@ import strawberry_django
|
||||
from strawberry_django import auto
|
||||
|
||||
from main import models
|
||||
from main.api.types.users import User
|
||||
from main.api.types.utils import JSONScalar
|
||||
|
||||
|
||||
@@ -32,7 +31,7 @@ class OrderOrdering:
|
||||
@strawberry_django.type(models.Order)
|
||||
class Order:
|
||||
id: auto
|
||||
customer: User
|
||||
customer: strawberry.LazyType["User", "main.api.types.users"]
|
||||
order_sum: auto
|
||||
created: auto
|
||||
orderlines: list["OrderLine"]
|
||||
@@ -60,3 +59,15 @@ class OrderStats:
|
||||
monthly: list[OrderStatsByTime]
|
||||
daily: list[OrderStatsByTime]
|
||||
hourly: list[OrderStatsByTime]
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class Point:
|
||||
x: str
|
||||
y: int
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class ProductOrderStat:
|
||||
product_name: str
|
||||
data: list[Point]
|
||||
+1
-12
@@ -6,6 +6,7 @@ from django.contrib.auth import get_user_model
|
||||
from strawberry_django import auto
|
||||
|
||||
from main import models
|
||||
from main.api.types.shop import Point, ProductOrderStat
|
||||
|
||||
UserModel = get_user_model()
|
||||
|
||||
@@ -17,18 +18,6 @@ class TopMonth:
|
||||
sum: int
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class Point:
|
||||
x: str
|
||||
y: int
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class ProductOrderStat:
|
||||
product_name: str
|
||||
data: list[Point]
|
||||
|
||||
|
||||
@strawberry_django.type(models.UserProfile)
|
||||
class UserProfile:
|
||||
id: auto
|
||||
|
||||
Reference in new issue
Block a user