Skip to content

Commit

Permalink
Code alignments, formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nuzil committed Aug 28, 2018
1 parent 09dc09c commit ef7f579
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Magento\Framework\Encryption\EncryptorInterface as Encryptor;
use Magento\Customer\Model\CustomerRegistry;


/**
* Customers field resolver, used for GraphQL request processing.
*/
Expand All @@ -46,11 +45,6 @@ class CustomerUpdate implements ResolverInterface
*/
protected $subscriberFactory;

/**
* @var AuthenticationInterface
*/
private $authentication;

/**
* @var CustomerRegistry
*/
Expand Down Expand Up @@ -118,33 +112,27 @@ public function resolve(
if (isset($args['firstname'])) {
$customer->setFirstname($args['firstname']);
}
if (isset($args['lastname'])){
if (isset($args['lastname'])) {
$customer->setLastname($args['lastname']);
}

$customer->setStoreId($this->storeResolver->getCurrentStoreId());
$this->customerRepository->save($customer);

if (isset($args['is_subscribed'])) {

$checkSubscriber = $this->subscriberFactory->create()->loadByCustomerId($context->getUserId());

if ($args['is_subscribed'] === true && !$checkSubscriber->isSubscribed()) {
$this->subscriberFactory->create()->subscribeCustomerById($context->getUserId());
} elseif ($args['is_subscribed'] === false && $checkSubscriber->isSubscribed()) {
$this->subscriberFactory->create()->unsubscribeCustomerById($context->getUserId());
}
}


$data = $args;
$result = function () use ($data) {
return !empty($data) ? $data : [];
};

return $this->valueFactory->create($result);


}

}
1 change: 0 additions & 1 deletion app/code/Magento/CustomerGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ type customerItem {
firstname: String
lastname: String
email: String
password: String
is_subscribed: Boolean
}

0 comments on commit ef7f579

Please sign in to comment.