From 0cef90ffb8bf7af17768e9a1ced6d89ed2ee1097 Mon Sep 17 00:00:00 2001 From: Leander Furumo Date: Wed, 4 Nov 2026 21:50:18 +0100 Subject: [PATCH] automatically disable products with 0 in stock --- bbs/api/mutations/inventory.py | 7 ++- bbs/api/mutations/shop.py | 3 +- bbs/models.py | 9 ++++ bbs/tests/test_models.py | 27 ++++++++++ bbs/tests/test_mutations.py | 52 +++++++++++++++++++ .../src/features/inventory/InventoryAdd.tsx | 4 +- .../inventory/inventoryProducts.graphql | 3 +- frontend/src/types.ts | 4 +- 8 files changed, 98 insertions(+), 11 deletions(-) diff --git a/bbs/api/mutations/inventory.py b/bbs/api/mutations/inventory.py index a65abc7..ee2c0f3 100644 --- a/bbs/api/mutations/inventory.py +++ b/bbs/api/mutations/inventory.py @@ -41,13 +41,12 @@ def create_inventory_transaction( return FormErrors(message=message, fields=[FieldError(field="user", message=message)]) try: - product = models.Product.objects.get(pk=data.product_id, active=True) + product = models.Product.objects.get(pk=data.product_id) except models.Product.DoesNotExist, ValueError: - message = "Velg et aktivt produkt." + message = "Velg et produkt." return FormErrors(message=message, fields=[FieldError(field="product_id", message=message)]) - product.inventory_amount += data.amount - product.save() + product.adjust_inventory(data.amount) inventory_transaction = models.InventoryTransaction.objects.create( user=user, product=product, diff --git a/bbs/api/mutations/shop.py b/bbs/api/mutations/shop.py index 893d219..1a96ffa 100644 --- a/bbs/api/mutations/shop.py +++ b/bbs/api/mutations/shop.py @@ -74,8 +74,7 @@ def create_order(customer_id: ID, order_lines: list[OrderLineInput], is_external # create for ol in ols: - ol.product.inventory_amount -= ol.amount - ol.product.save() + ol.product.adjust_inventory(-ol.amount) order = models.Order.objects.create(customer=user, order_sum=order_sum) for ol in ols: ol.order = order diff --git a/bbs/models.py b/bbs/models.py index 067d75a..1362d23 100755 --- a/bbs/models.py +++ b/bbs/models.py @@ -75,6 +75,15 @@ class Product(models.Model): def wholesale_value(self): return self.wholesale_unit_price * self.inventory_amount + def adjust_inventory(self, amount): + """Change the stock by amount, deactivating the product when it sells out and reactivating it on restock.""" + self.inventory_amount += amount + if self.inventory_amount <= 0: + self.active = False + elif amount > 0: + self.active = True + self.save() + @property def image_url(self): return self.image.url if self.image else "" diff --git a/bbs/tests/test_models.py b/bbs/tests/test_models.py index b6d5c68..fb2b216 100644 --- a/bbs/tests/test_models.py +++ b/bbs/tests/test_models.py @@ -311,3 +311,30 @@ def test_save_preserves_existing_image(db): # noqa: ARG001 u = DjangoUser.objects.create_user(username="img@test.com", email="img@test.com") profile = UserProfile.objects.create(user=u, balance=0, image="https://example.com/custom.jpg") assert profile.image == "https://example.com/custom.jpg" + + +# Product.adjust_inventory +# ======================== + + +@pytest.mark.django_db +@pytest.mark.parametrize( + ("start", "amount", "active_before", "expected_amount", "expected_active"), + [ + (2, -1, True, 1, True), # sale leaving stock + (1, -1, True, 0, False), # sells out + (0, -1, True, -1, False), # oversold + (0, 5, False, 5, True), # restock reactivates + (-3, 2, False, -1, False), # restock still not in stock + (5, -1, False, 4, False), # sale keeps a manually deactivated product inactive + (5, 1, False, 6, True), # restock reactivates a manually deactivated product + ], +) +def test_adjust_inventory(start, amount, active_before, expected_amount, expected_active): + product = Product.objects.create( + name="borg", sale_price_int=30, sale_price_ext=35, inventory_amount=start, active=active_before + ) + product.adjust_inventory(amount) + product.refresh_from_db() + assert product.inventory_amount == expected_amount + assert product.active is expected_active diff --git a/bbs/tests/test_mutations.py b/bbs/tests/test_mutations.py index 1c0bc5f..150cd9c 100644 --- a/bbs/tests/test_mutations.py +++ b/bbs/tests/test_mutations.py @@ -161,6 +161,31 @@ def test_create_inventory_transaction_updates_stock(product, gql_client, client) assert transaction["user"]["id"] == str(user.id) product.refresh_from_db() assert product.inventory_amount == 5 + assert product.active + + +def test_create_inventory_transaction_reactivates_inactive_product(product, gql_client, client): + product.active = False + product.save() + client.force_login(get_user_model().objects.create_user(username="stock-manager")) + + result = gql_client.query( + """ + mutation CreateInventoryTransaction($data: InventoryTransactionInput!) { + createInventoryTransaction(data: $data) { + ... on CreateInventoryTransactionSuccess { inventoryTransaction { product { active inventoryAmount } } } + ... on FormErrors { message } + } + } + """, + variables={"data": {"productId": str(product.id), "amount": 3, "unitPrice": "12.5"}}, + ) + + assert not result.errors + assert result.data["createInventoryTransaction"]["inventoryTransaction"]["product"] == { + "active": True, + "inventoryAmount": 3, + } def test_inventory_report_aggregates_period_data(product, gql_client): @@ -299,6 +324,33 @@ def test_create_order_internal_success(user, product, gql_client): assert user.profile.balance == 70 product.refresh_from_db() assert product.inventory_amount == -1 + assert not product.active + + +def test_create_order_deactivates_sold_out_product(user, product, gql_client): + product.inventory_amount = 2 + product.save() + user.profile.balance = 100 + user.profile.save() + + def buy(): + res = gql_client.query( + CREATE_ORDER, + { + "customerId": str(user.id), + "isExternal": False, + "orderLines": [{"productId": product.id, "amount": 1}], + }, + ) + assert not res.errors + product.refresh_from_db() + + buy() + assert product.inventory_amount == 1 + assert product.active + buy() + assert product.inventory_amount == 0 + assert not product.active def test_create_order_exact_balance(user, product, gql_client): diff --git a/frontend/src/features/inventory/InventoryAdd.tsx b/frontend/src/features/inventory/InventoryAdd.tsx index fdda556..9c85b03 100644 --- a/frontend/src/features/inventory/InventoryAdd.tsx +++ b/frontend/src/features/inventory/InventoryAdd.tsx @@ -66,7 +66,7 @@ const InventoryAdd = () => { {products.map((product) => ( ))} @@ -96,7 +96,7 @@ const InventoryAdd = () => { Avbryt - {!products.length &&

Ingen aktive varer å registrere.

} + {!products.length &&

Ingen varer å registrere.

} ); }; diff --git a/frontend/src/features/inventory/inventoryProducts.graphql b/frontend/src/features/inventory/inventoryProducts.graphql index 034d0e7..f4affe3 100644 --- a/frontend/src/features/inventory/inventoryProducts.graphql +++ b/frontend/src/features/inventory/inventoryProducts.graphql @@ -1,7 +1,8 @@ query inventoryProducts { - allProducts(filters: { active: true }) { + allProducts { id name + active inventoryAmount } } diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 889b23d..a31641f 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -384,7 +384,7 @@ export type InventoryPageQuery = { __typename: 'Query', allProducts: Array<{ __t export type InventoryProductsQueryVariables = Exact<{ [key: string]: never; }>; -export type InventoryProductsQuery = { __typename: 'Query', allProducts: Array<{ __typename: 'Product', id: string, name: string, inventoryAmount: number }> }; +export type InventoryProductsQuery = { __typename: 'Query', allProducts: Array<{ __typename: 'Product', id: string, name: string, active: boolean, inventoryAmount: number }> }; export type InventoryReportQueryVariables = Exact<{ startTime: string; @@ -467,7 +467,7 @@ export const CreateUserDocument = {"kind":"Document","definitions":[{"kind":"Ope export const CreateDepositDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateDeposit"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"userId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"amount"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createDeposit"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"userId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"userId"}}},{"kind":"Argument","name":{"kind":"Name","value":"amount"},"value":{"kind":"Variable","name":{"kind":"Name","value":"amount"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CreateDepositSuccess"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transaction"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"profile"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}}]}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AboveMaxSaldo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"maxSaldo"}},{"kind":"Field","name":{"kind":"Name","value":"above"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FormErrors"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"fields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"field"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const CreateInventoryTransactionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"createInventoryTransaction"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"InventoryTransactionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createInventoryTransaction"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CreateInventoryTransactionSuccess"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"inventoryTransaction"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"product"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"inventoryAmount"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FormErrors"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"fields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"field"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const InventoryPageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"inventoryPage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}},"defaultValue":{"kind":"IntValue","value":"20"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"offset"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}},"defaultValue":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allProducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"inventoryAmount"}},{"kind":"Field","name":{"kind":"Name","value":"updated"}},{"kind":"Field","name":{"kind":"Name","value":"wholesaleUnitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"wholesaleValue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"inventoryTransactionList"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ordering"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"created"},"value":{"kind":"EnumValue","value":"DESC"}}]}]}},{"kind":"Argument","name":{"kind":"Name","value":"pagination"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"offset"},"value":{"kind":"Variable","name":{"kind":"Name","value":"offset"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"created"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"comment"}},{"kind":"Field","name":{"kind":"Name","value":"product"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}}]}}]}}]} as unknown as DocumentNode; -export const InventoryProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"inventoryProducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allProducts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"active"},"value":{"kind":"BooleanValue","value":true}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"inventoryAmount"}}]}}]}}]} as unknown as DocumentNode; +export const InventoryProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"inventoryProducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allProducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"inventoryAmount"}}]}}]}}]} as unknown as DocumentNode; export const InventoryReportDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"inventoryReport"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"startTime"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"endTime"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"inventoryReport"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"startTime"},"value":{"kind":"Variable","name":{"kind":"Name","value":"startTime"}}},{"kind":"Argument","name":{"kind":"Name","value":"endTime"},"value":{"kind":"Variable","name":{"kind":"Name","value":"endTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productId"}},{"kind":"Field","name":{"kind":"Name","value":"productName"}},{"kind":"Field","name":{"kind":"Name","value":"purchaseUnits"}},{"kind":"Field","name":{"kind":"Name","value":"purchaseValue"}},{"kind":"Field","name":{"kind":"Name","value":"salesUnits"}},{"kind":"Field","name":{"kind":"Name","value":"salesValue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"inventoryPurchases"}},{"kind":"Field","name":{"kind":"Name","value":"productSales"}},{"kind":"Field","name":{"kind":"Name","value":"deposits"}},{"kind":"Field","name":{"kind":"Name","value":"orderPurchases"}},{"kind":"Field","name":{"kind":"Name","value":"balanceAtStart"}},{"kind":"Field","name":{"kind":"Name","value":"balanceAtEnd"}}]}}]}}]} as unknown as DocumentNode; export const OrderListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"orderList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}},"defaultValue":{"kind":"IntValue","value":"10"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"offset"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}},"defaultValue":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderList"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ordering"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"created"},"value":{"kind":"EnumValue","value":"DESC"}}]}]}},{"kind":"Argument","name":{"kind":"Name","value":"pagination"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"offset"},"value":{"kind":"Variable","name":{"kind":"Name","value":"offset"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isExternal"}},{"kind":"Field","name":{"kind":"Name","value":"created"}},{"kind":"Field","name":{"kind":"Name","value":"orderSum"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"profile"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"orderlines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"product"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"salePriceExt"}},{"kind":"Field","name":{"kind":"Name","value":"salePriceInt"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const TransactionListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"transactionList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}},"defaultValue":{"kind":"IntValue","value":"10"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"offset"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}},"defaultValue":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactionList"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ordering"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"created"},"value":{"kind":"EnumValue","value":"DESC"}}]}]}},{"kind":"Argument","name":{"kind":"Name","value":"pagination"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"offset"},"value":{"kind":"Variable","name":{"kind":"Name","value":"offset"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"created"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"profile"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}}]}}]}}]}}]}}]} as unknown as DocumentNode;