Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Allow to sort ExportFiles by app
IKarbowiak6015a4366b79
diff --git a/saleor/graphql/csv/sorters.py b/saleor/graphql/csv/sorters.pyindex fc94c75656..086ced59c8 100644--- a/saleor/graphql/csv/sorters.py+++ b/saleor/graphql/csv/sorters.py@@ -8,6 +8,7 @@ class ExportFileSortField(graphene.Enum):CREATED_AT = ["created_at"]UPDATED_AT = ["updated_at"]USER = ["user__id"]+ APP = ["app__id"]@propertydef description(self):diff --git a/saleor/graphql/csv/tests/queries/test_export_files.py b/saleor/graphql/csv/tests/queries/test_export_files.pyindex c06851fb03..638fe9d964 100644--- a/saleor/graphql/csv/tests/queries/test_export_files.py+++ b/saleor/graphql/csv/tests/queries/test_export_files.py@@ -249,6 +249,37 @@ def test_sort_export_files_query_by_user(assert nodes[0]["node"]["user"]["email"] == second_staff_user.email+def test_sort_export_files_query_by_app(+ app,+ staff_api_client,+ app_export_file,+ permission_manage_products,+ permission_manage_apps,+ permission_manage_users,+):+ app2 = App.objects.create(name="App 2", is_active=True)+ app2.tokens.create(name="Default")++ ExportFile.objects.create(app=app2)+ query = SORT_EXPORT_FILES_QUERY+ variables = {"sortBy": {"field": "APP", "direction": "DESC"}}++ response = staff_api_client.post_graphql(+ query,+ variables=variables,+ permissions=[+ permission_manage_products,+ permission_manage_users,+ permission_manage_apps,+ ],+ )+ content = get_graphql_content(response)+ nodes = content["data"]["exportFiles"]["edges"]++ assert len(nodes) == 2+ assert nodes[0]["node"]["app"]["name"] == app2.name++def test_sort_export_files_query_by_created_at_date(staff_api_client,user_export_file,diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 577fb83a17..5c00512d86 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1810,6 +1810,7 @@ enum ExportFileSortField {CREATED_ATUPDATED_ATUSER+ APP}input ExportFileSortingInput {