Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove pagination from webhook events query

Maciej Korycinskia9658ccfe206
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 7f5faf6de0..76476e166f 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -3328,7 +3328,7 @@ type ProductVariantUpdatePrivateMeta {
type Query {
webhook(id: ID!): Webhook
webhooks(filter: WebhookFilterInput, before: String, after: String, first: Int, last: Int): WebhookCountableConnection
- webhookEvents(before: String, after: String, first: Int, last: Int): WebhookEventCountableConnection
+ webhookEvents: [WebhookEvent]
webhookSamplePayload(eventType: WebhookEventTypeEnum!): JSONString
translations(kind: TranslatableKinds!, before: String, after: String, first: Int, last: Int): TranslatableItemConnection
shop: Shop
@@ -4321,17 +4321,6 @@ type WebhookEvent {
name: String
}
-type WebhookEventCountableConnection {
- pageInfo: PageInfo!
- edges: [WebhookEventCountableEdge!]!
- totalCount: Int
-}
-
-type WebhookEventCountableEdge {
- node: WebhookEvent!
- cursor: String!
-}
-
enum WebhookEventTypeEnum {
ANY_EVENTS
ORDER_CREATED
diff --git a/saleor/graphql/webhook/schema.py b/saleor/graphql/webhook/schema.py
index 7694bd3bcd..131e1aef88 100644
--- a/saleor/graphql/webhook/schema.py
+++ b/saleor/graphql/webhook/schema.py
@@ -1,6 +1,6 @@
import graphene
-from ..core.fields import FilterInputConnectionField, PrefetchingConnectionField
+from ..core.fields import FilterInputConnectionField
from ..decorators import permission_required
from .enums import WebhookEventTypeEnum
from .filters import WebhookFilterInput
@@ -27,7 +27,7 @@ class WebhookQueries(graphene.ObjectType):
description="List of webhooks.",
filter=WebhookFilterInput(description="Filtering options for webhooks."),
)
- webhook_events = PrefetchingConnectionField(
+ webhook_events = graphene.List(
WebhookEvent, description="List of all available webhook events."
)
diff --git a/tests/api/test_webhook.py b/tests/api/test_webhook.py
index cdbf758617..8e442721b9 100644
--- a/tests/api/test_webhook.py
+++ b/tests/api/test_webhook.py
@@ -514,13 +514,9 @@ def test_query_webhook_by_service_account_without_permission(
WEBHOOK_EVENTS_QUERY = """
{
- webhookEvents(first:10){
- edges{
- node{
- eventType
- name
- }
- }
+ webhookEvents{
+ eventType
+ name
}
}
"""
@@ -531,7 +527,7 @@ def test_query_webhook_events(staff_api_client, permission_manage_webhooks):
staff_api_client.user.user_permissions.add(permission_manage_webhooks)
response = staff_api_client.post_graphql(query)
content = get_graphql_content(response)
- webhook_events = content["data"]["webhookEvents"]["edges"]
+ webhook_events = content["data"]["webhookEvents"]
assert len(webhook_events) == len(WebhookEventType.CHOICES)