Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add delete product mutation
Adam Janikb09b1fbc0ae5
diff --git a/saleor/dashboard/graphql/api.py b/saleor/dashboard/graphql/api.pyindex b9d8ac66d9..42c695e1ed 100644--- a/saleor/dashboard/graphql/api.py+++ b/saleor/dashboard/graphql/api.py@@ -14,7 +14,7 @@ from .page.types import resolve_all_pagesfrom .product.filters import ProductFilterfrom .product.mutations import (CategoryCreateMutation, CategoryDelete, CategoryUpdateMutation,- ProductCreateMutation)+ ProductCreateMutation, ProductDeleteMutation)class Query(graphene.ObjectType):@@ -72,6 +72,7 @@ class Mutations(graphene.ObjectType):page_update = PageUpdate.Field()product_create = ProductCreateMutation.Field()+ product_delete = ProductDeleteMutation.Field()token_auth = graphql_jwt.ObtainJSONWebToken.Field()verify_token = graphql_jwt.Verify.Field()diff --git a/saleor/dashboard/graphql/product/mutations.py b/saleor/dashboard/graphql/product/mutations.pyindex 7fd84b439b..9a62a00430 100644--- a/saleor/dashboard/graphql/product/mutations.py+++ b/saleor/dashboard/graphql/product/mutations.py@@ -104,3 +104,9 @@ class ProductCreateMutation(ModelFormMutation):errors = convert_form_errors(form)return cls(errors=errors)return super().mutate(root, info, **kwargs)+++class ProductDeleteMutation(ModelDeleteMutation):++ class Meta:+ model = models.Productdiff --git a/saleor/graphql/product/types.py b/saleor/graphql/product/types.pyindex aec98886fa..b907ad5d8c 100644--- a/saleor/graphql/product/types.py+++ b/saleor/graphql/product/types.py@@ -120,8 +120,6 @@ class Category(CountableDjangoObjectType):return qs.distinct()--class ProductImage(CountableDjangoObjectType):url = graphene.String(size=graphene.String())