Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
#141 Restored the modularity
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Glushko committed Sep 6, 2018
1 parent 8507bad commit 5140906
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 37 deletions.
8 changes: 0 additions & 8 deletions app/code/Magento/CatalogGraphQl/etc/graphql/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Catalog\Model\Product\Option\Type\Date" type="Magento\CatalogGraphQl\Model\Product\Option\DateType" />
<type name="Magento\CatalogGraphQl\Model\ProductInterfaceTypeResolverComposite">
<arguments>
<argument name="productTypeNameResolvers" xsi:type="array">
Expand Down Expand Up @@ -74,11 +73,4 @@
</argument>
</arguments>
</virtualType>
<type name="Magento\QuoteGraphQl\Model\Resolver\CartItemTypeResolver">
<arguments>
<argument name="cartItemTypes" xsi:type="array">
<item name="simple" xsi:type="string">SimpleCartItem</item>
</argument>
</arguments>
</type>
</config>
27 changes: 0 additions & 27 deletions app/code/Magento/CatalogGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 26 additions & 0 deletions app/code/Magento/SimpleProductGraphQl/composer.json
Original file line number Diff line number Diff line change
@@ -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\\": ""
}
}
}
16 changes: 16 additions & 0 deletions app/code/Magento/SimpleProductGraphQl/etc/graphql/di.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\QuoteGraphQl\Model\Resolver\CartItemTypeResolver">
<arguments>
<argument name="cartItemTypes" xsi:type="array">
<item name="simple" xsi:type="string">SimpleCartItem</item>
</argument>
</arguments>
</type>
</config>
15 changes: 15 additions & 0 deletions app/code/Magento/SimpleProductGraphQl/etc/module.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_SimpleProductGraphQl">
<sequence>
<module name="Magento_GraphQl"/>
<module name="Magento_QuoteGraphQl"/>
</sequence>
</module>
</config>
29 changes: 29 additions & 0 deletions app/code/Magento/SimpleProductGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
@@ -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")
}
14 changes: 14 additions & 0 deletions app/code/Magento/SimpleProductGraphQl/registration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'Magento_SimpleProductGraphQl',
__DIR__
);
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"magento/module-google-optimizer": "*",
"magento/module-graph-ql": "*",
"magento/module-catalog-graph-ql": "*",
"magento/module-quote-graph-ql": "*",
"magento/module-simple-product-graph-ql": "*",
"magento/module-catalog-url-rewrite-graph-ql": "*",
"magento/module-configurable-product-graph-ql": "*",
"magento/module-customer-graph-ql": "*",
Expand Down Expand Up @@ -186,6 +186,7 @@
"magento/module-product-video": "*",
"magento/module-quote": "*",
"magento/module-quote-analytics": "*",
"magento/module-quote-graph-ql": "*",
"magento/module-release-notification": "*",
"magento/module-reports": "*",
"magento/module-require-js": "*",
Expand Down

0 comments on commit 5140906

Please sign in to comment.