diff --git a/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml b/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml index b81473567282..68a292ede6b4 100644 --- a/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml +++ b/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml @@ -6,7 +6,6 @@ */ --> - @@ -74,11 +73,4 @@ - - - - SimpleCartItem - - - diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls index e5d2d6d461f5..9235ec271a3c 100644 --- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls @@ -16,10 +16,6 @@ type Query { @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\CategoryTree") } -type Mutation { - addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Cart\\AddSimpleProductsToCart") -} - enum CurrencyEnum @doc(description: "The list of available currency codes") { AFN ALL @@ -555,26 +551,3 @@ type SortFields @doc(description: "SortFields contains a default value for sort default: String @doc(description: "Default value of sort fields") options: [SortField] @doc(description: "Available sort fields") } - -input AddSimpleProductsToCartInput { - cart_id: String! - cartItems: [SimpleProductCartItemInput!]! -} - -input SimpleProductCartItemInput { - details: CartItemDetailsInput! - customizable_options:[CustomizableOptionInput!] -} - -input CustomizableOptionInput { - id: Int! - value: String! -} - -type AddSimpleProductsToCartOutput { - cart: Cart! -} - -type SimpleCartItem implements CartItemInterface @doc(description: "Simple Cart Item") { - customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CartItem\\CustomizableOptions") -} \ No newline at end of file diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Cart/AddSimpleProductsToCart.php b/app/code/Magento/SimpleProductGraphQl/Model/Resolver/Cart/AddSimpleProductsToCart.php similarity index 99% rename from app/code/Magento/CatalogGraphQl/Model/Resolver/Cart/AddSimpleProductsToCart.php rename to app/code/Magento/SimpleProductGraphQl/Model/Resolver/Cart/AddSimpleProductsToCart.php index 67570092be81..497249f1d6e7 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Cart/AddSimpleProductsToCart.php +++ b/app/code/Magento/SimpleProductGraphQl/Model/Resolver/Cart/AddSimpleProductsToCart.php @@ -5,7 +5,7 @@ */ declare(strict_types=1); -namespace Magento\CatalogGraphQl\Model\Resolver\Cart; +namespace Magento\SimpleProductGraphQl\Model\Resolver\Cart; use Magento\Authorization\Model\UserContextInterface; use Magento\Catalog\Api\ProductRepositoryInterface; diff --git a/app/code/Magento/SimpleProductGraphQl/composer.json b/app/code/Magento/SimpleProductGraphQl/composer.json new file mode 100644 index 000000000000..5b65a11785b5 --- /dev/null +++ b/app/code/Magento/SimpleProductGraphQl/composer.json @@ -0,0 +1,26 @@ +{ + "name": "magento/module-simple-product-graph-ql", + "description": "N/A", + "type": "magento2-module", + "require": { + "php": "~7.1.3||~7.2.0", + "magento/framework": "*", + "magento/module-authorization": "*" + }, + "suggest": { + "magento/module-graph-ql": "*", + "magento/module-quote-graph-ql": "*" + }, + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\SimpleProductGraphQl\\": "" + } + } +} diff --git a/app/code/Magento/SimpleProductGraphQl/etc/graphql/di.xml b/app/code/Magento/SimpleProductGraphQl/etc/graphql/di.xml new file mode 100644 index 000000000000..820c9c468907 --- /dev/null +++ b/app/code/Magento/SimpleProductGraphQl/etc/graphql/di.xml @@ -0,0 +1,16 @@ + + + + + + + SimpleCartItem + + + + \ No newline at end of file diff --git a/app/code/Magento/SimpleProductGraphQl/etc/module.xml b/app/code/Magento/SimpleProductGraphQl/etc/module.xml new file mode 100644 index 000000000000..5c0d7e0eb7c4 --- /dev/null +++ b/app/code/Magento/SimpleProductGraphQl/etc/module.xml @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/app/code/Magento/SimpleProductGraphQl/etc/schema.graphqls b/app/code/Magento/SimpleProductGraphQl/etc/schema.graphqls new file mode 100644 index 000000000000..40bbabc8e791 --- /dev/null +++ b/app/code/Magento/SimpleProductGraphQl/etc/schema.graphqls @@ -0,0 +1,29 @@ +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + +type Mutation { + addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput @resolver(class: "Magento\\SimpleProductGraphQl\\Model\\Resolver\\Cart\\AddSimpleProductsToCart") +} + +input AddSimpleProductsToCartInput { + cart_id: String! + cartItems: [SimpleProductCartItemInput!]! +} + +input SimpleProductCartItemInput { + details: CartItemDetailsInput! + customizable_options:[CustomizableOptionInput!] +} + +input CustomizableOptionInput { + id: Int! + value: String! +} + +type AddSimpleProductsToCartOutput { + cart: Cart! +} + +type SimpleCartItem implements CartItemInterface @doc(description: "Simple Cart Item") { + customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CartItem\\CustomizableOptions") +} \ No newline at end of file diff --git a/app/code/Magento/SimpleProductGraphQl/registration.php b/app/code/Magento/SimpleProductGraphQl/registration.php new file mode 100644 index 000000000000..87c9a5fcec83 --- /dev/null +++ b/app/code/Magento/SimpleProductGraphQl/registration.php @@ -0,0 +1,14 @@ +