Skip to content

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

Remove unnecessary connections

Marcin Gębala84714c108255
diff --git a/saleor/graphql/account/types.py b/saleor/graphql/account/types.py
index f6ecd7a35c..d1f0e0bfdb 100644
--- a/saleor/graphql/account/types.py
+++ b/saleor/graphql/account/types.py
@@ -50,7 +50,7 @@ class User(CountableDjangoObjectType):
note = graphene.String(description='A note about the customer')
class Meta:
- exclude_fields = ['password', 'is_superuser', 'OrderEvent_set']
+ exclude_fields = ['carts', 'password', 'is_superuser', 'OrderEvent_set']
description = 'Represents user data.'
interfaces = [relay.Node]
model = get_user_model()
diff --git a/saleor/graphql/product/types.py b/saleor/graphql/product/types.py
index 94a4c27ef5..9cfe28b27e 100644
--- a/saleor/graphql/product/types.py
+++ b/saleor/graphql/product/types.py
@@ -191,7 +191,7 @@ class ProductVariant(CountableDjangoObjectType):
class Meta:
description = dedent("""Represents a version of a product such as
different size or color.""")
- exclude_fields = ['variant_images']
+ exclude_fields = ['order_lines', 'variant_images']
interfaces = [relay.Node]
model = models.ProductVariant
@@ -438,9 +438,6 @@ class Category(CountableDjangoObjectType):
prefetch_related=prefetch_products)
url = graphene.String(
description='The storefront\'s URL for the category.')
- ancestors = PrefetchingConnectionField(
- lambda: Category,
- description='List of ancestors of the category.')
children = PrefetchingConnectionField(
lambda: Category,
description='List of children of the category.')
@@ -456,10 +453,6 @@ class Category(CountableDjangoObjectType):
interfaces = [relay.Node]
model = models.Category
- def resolve_ancestors(self, info, **kwargs):
- qs = self.get_ancestors()
- return gql_optimizer.query(qs, info)
-
def resolve_background_image(self, info, **kwargs):
return self.background_image or None
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 9864690f3c..574c1bc076 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -231,7 +231,6 @@ type Category implements Node {
children(before: String, after: String, first: Int, last: Int): CategoryCountableConnection
products(before: String, after: String, first: Int, last: Int): ProductCountableConnection
url: String
- ancestors(before: String, after: String, first: Int, last: Int): CategoryCountableConnection
}
type CategoryCountableConnection {
@@ -1085,17 +1084,6 @@ type OrderLine implements Node {
thumbnailUrl(size: Int): String
}
-type OrderLineCountableConnection {
- pageInfo: PageInfo!
- edges: [OrderLineCountableEdge!]!
- totalCount: Int
-}
-
-type OrderLineCountableEdge {
- node: OrderLine!
- cursor: String!
-}
-
input OrderLineCreateInput {
quantity: Int!
variantId: ID!
@@ -1503,7 +1491,6 @@ type ProductVariant implements Node {
quantityAllocated: Int!
costPrice: Money
weight: Weight
- orderLines(before: String, after: String, first: Int, last: Int): OrderLineCountableConnection
stockQuantity: Int!
price: Money
margin: Int
@@ -1696,7 +1683,6 @@ type ShippingMethod implements Node {
maximumOrderPrice: Money
minimumOrderWeight: Weight
maximumOrderWeight: Weight
- carts(before: String, after: String, first: Int, last: Int, token: UUID): CheckoutCountableConnection
}
enum ShippingMethodTypeEnum {
@@ -1940,7 +1926,6 @@ type User implements Node {
dateJoined: DateTime!
defaultShippingAddress: Address
defaultBillingAddress: Address
- carts(before: String, after: String, first: Int, last: Int, token: UUID): CheckoutCountableConnection
orders(before: String, after: String, first: Int, last: Int): OrderCountableConnection
permissions: [PermissionDisplay]
}
diff --git a/saleor/graphql/shipping/types.py b/saleor/graphql/shipping/types.py
index 26b6dec116..7ad723ba27 100644
--- a/saleor/graphql/shipping/types.py
+++ b/saleor/graphql/shipping/types.py
@@ -27,7 +27,7 @@ class ShippingMethod(CountableDjangoObjectType):
They are directly exposed to the customers.""")
model = models.ShippingMethod
interfaces = [relay.Node]
- exclude_fields = ['shipping_zone', 'orders']
+ exclude_fields = ['carts', 'shipping_zone', 'orders']
class ShippingZone(CountableDjangoObjectType):