⬇ Downgrade to python 3.8

This commit is contained in:
nikolark committed 2022-02-20 00:54:00 +01:00
1 parent 9b903f42d6
commit eace79f012
10 files changed
+312 -70

No files matched your search

+3 -1
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
@@ -17,6 +19,6 @@ class FieldError(Error):
@strawberry.type
class FormErrors:
fields: list[FieldError]
fields: List[FieldError]
message: str = ""
error: bool = True
+3 -1
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
from django.conf import settings
from django.contrib.auth import get_user_model
@@ -34,7 +36,7 @@ CreateOrderResponse = strawberry.union("CreateOrderResponse", [CreateOrderSucces
@strawberry.mutation
@transaction.atomic
def create_order(customer_id: ID, order_lines: list[OrderLineInput], is_external: bool = False) -> CreateOrderResponse:
def create_order(customer_id: ID, order_lines: List[OrderLineInput], is_external: bool = False) -> CreateOrderResponse:
# clean and validate
try:
user = UserModel.objects.get(pk=customer_id)
+3 -1
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
@@ -6,4 +8,4 @@ from bbs.api.types.inventory import Transaction, TransactionOrdering
@strawberry.type
class InventoryQueries:
transaction_list: list[Transaction] = strawberry_django.field(pagination=True, order=TransactionOrdering)
transaction_list: List[Transaction] = strawberry_django.field(pagination=True, order=TransactionOrdering)
+6 -4
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
@@ -7,9 +9,9 @@ from bbs.api.types.shop import Order, OrderOrdering, OrderStats, OrderStatsByTim
@strawberry.type
class ShopQueries:
all_products: list[Product] = strawberry_django.field()
all_orders: list[Order] = strawberry_django.field()
order_list: list[Order] = strawberry_django.field(pagination=True, order=OrderOrdering)
all_products: List[Product] = strawberry_django.field()
all_orders: List[Order] = strawberry_django.field()
order_list: List[Order] = strawberry_django.field(pagination=True, order=OrderOrdering)
@strawberry.field
def order_stats(self) -> OrderStats:
@@ -24,7 +26,7 @@ class ShopQueries:
)
@strawberry.field
def product_stats(self) -> list[ProductOrderStat]:
def product_stats(self) -> List[ProductOrderStat]:
return [
ProductOrderStat(product_name=stat["product_name"], data=[Point(**p) for p in stat["data"]])
for stat in models.OrderLine.objects.product_order_stats().as_series()
+8 -6
View File
@@ -1,3 +1,5 @@
from typing import List
import strawberry
import strawberry_django
from strawberry_django import auto
@@ -34,7 +36,7 @@ class Order:
customer: strawberry.LazyType["User", "bbs.api.types.users"]
order_sum: auto
created: auto
orderlines: list["OrderLine"]
orderlines: List["OrderLine"]
is_external: bool
@@ -55,10 +57,10 @@ class OrderStatsByTime:
@strawberry.type
class OrderStats:
yearly: list[OrderStatsByTime]
monthly: list[OrderStatsByTime]
daily: list[OrderStatsByTime]
hourly: list[OrderStatsByTime]
yearly: List[OrderStatsByTime]
monthly: List[OrderStatsByTime]
daily: List[OrderStatsByTime]
hourly: List[OrderStatsByTime]
@strawberry.type
@@ -70,4 +72,4 @@ class Point:
@strawberry.type
class ProductOrderStat:
product_name: str
data: list[Point]
data: List[Point]
+3 -2
View File
@@ -1,4 +1,5 @@
from datetime import datetime
from typing import List
import strawberry
import strawberry_django
@@ -27,11 +28,11 @@ class UserProfile:
order_sum_total: float
@strawberry.field()
def top_months(self) -> list[TopMonth]:
def top_months(self) -> List[TopMonth]:
return [TopMonth(**month) for month in self.top_months()]
@strawberry.field()
def product_order_stats(self) -> list[ProductOrderStat]:
def product_order_stats(self) -> List[ProductOrderStat]:
return [
ProductOrderStat(product_name=stat["product_name"], data=[Point(**p) for p in stat["data"]])
for stat in self.product_order_stats().as_series()