diff --git a/Model/Resolver/ReviewSeller.php b/Model/Resolver/ReviewSeller.php index 8bb0a97..77d1c42 100644 --- a/Model/Resolver/ReviewSeller.php +++ b/Model/Resolver/ReviewSeller.php @@ -99,16 +99,20 @@ public function resolve( if (!($args['input']) || !isset($args['input'])) { throw new GraphQlInputException(__('"input" value should be specified')); } + if (!isset($args['input']['seller_url']) || (isset($args['input']['seller_url']) && !$args['input']['seller_url'])) { + throw new GraphQlInputException(__('seller_url is required.')); + } $args = $args['input']; - $seller = $this->sellerRepository->get((int)$args['seller_id']); - if (!isset($seller['seller_id']) || !$seller['seller_id']) { + $seller = $this->sellerRepository->getByUrl($args['seller_url']); + if (!$seller || (!$seller->getId())) { return [ "code" => 1, "message" => "Seller does not exits!" ]; } - $args['seller_email'] = $seller['email']; - $args['seller_name'] = $seller['name']; + $args['seller_id'] = $seller->getId(); + $args['seller_email'] = $seller->getEmail(); + $args['seller_name'] = $seller->getName(); $args['rating'] = ($args['rate1']+$args['rate2']+$args['rate3'])/3; if($this->helper->getConfig('general_settings/rating_approval')) { diff --git a/README.md b/README.md index 66b03e0..66b2099 100755 --- a/README.md +++ b/README.md @@ -530,7 +530,7 @@ mutation { mutation { reviewSeller( input: { - seller_id : String! + seller_url : String! rate1 : Int! rate2 : Int! rate3 : Int! diff --git a/composer.json b/composer.json index 90d6b72..6b00c6f 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "minimum-stability": "dev", - "version": "1.0.3", + "version": "1.0.4", "require": { "landofcoder/module-marketplace": "*" }, diff --git a/etc/schema.graphqls b/etc/schema.graphqls index c311da1..d356060 100755 --- a/etc/schema.graphqls +++ b/etc/schema.graphqls @@ -465,7 +465,7 @@ input SellerInput { } input ReviewInput { - seller_id : String! + seller_url : String! rate1 : Int! rate2 : Int! rate3 : Int! @@ -473,6 +473,9 @@ input ReviewInput { email : String! title : String! detail : String! + like_about: String + not_like_about: String + is_recommended: Int } input CustomerDataInput {