✨ Sort orders and transactions newest first

🔧 Don't run linting using pipenv
This commit is contained in:
Nikolai R Kristiansen committed 2022-02-05 21:56:56 +01:00
1 parent ed99dadcb0
commit 1bd8fddf73
7 files changed
+64 -26

No files matched your search

+3 -3
View File
@@ -2,7 +2,7 @@ import strawberry
import strawberry_django
from main.api import mutations
from main.api.types import Order, Product, Transaction, User
from main.api.types import Order, OrderOrdering, Product, Transaction, TransactionOrdering, User
@strawberry.type
@@ -10,8 +10,8 @@ class Query:
all_products: list[Product] = strawberry_django.field()
all_users: list[User] = strawberry_django.field()
all_orders: list[Order] = strawberry_django.field()
order_list: list[Order] = strawberry_django.field(pagination=True)
transaction_list: list[Transaction] = strawberry_django.field(pagination=True)
order_list: list[Order] = strawberry_django.field(pagination=True, order=OrderOrdering)
transaction_list: list[Transaction] = strawberry_django.field(pagination=True, order=TransactionOrdering)
@strawberry.type
+10 -1
View File
@@ -42,7 +42,11 @@ class User:
first_name: auto
last_name: auto
profile: UserProfile
# todo
@strawberry_django.ordering.order(models.Order)
class OrderOrdering:
created: auto
@strawberry_django.type(models.Order)
@@ -64,6 +68,11 @@ class OrderLine:
unit_price: auto
@strawberry_django.ordering.order(models.Transaction)
class TransactionOrdering:
created: auto
@strawberry_django.type(models.Transaction)
class Transaction:
id: auto