Skip to content

Commit

Permalink
Merge pull request #23 from landofcoder/update-review-seller-mutation
Browse files Browse the repository at this point in the history
Update review seller mutation
  • Loading branch information
landofcoder authored Aug 8, 2022
2 parents 248b901 + 8ac0418 commit c1cd48a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
12 changes: 8 additions & 4 deletions Model/Resolver/ReviewSeller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ mutation {
mutation {
reviewSeller(
input: {
seller_id : String!
seller_url : String!
rate1 : Int!
rate2 : Int!
rate3 : Int!
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"minimum-stability": "dev",
"version": "1.0.3",
"version": "1.0.4",
"require": {
"landofcoder/module-marketplace": "*"
},
Expand Down
5 changes: 4 additions & 1 deletion etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,17 @@ input SellerInput {
}

input ReviewInput {
seller_id : String!
seller_url : String!
rate1 : Int!
rate2 : Int!
rate3 : Int!
nickname : String!
email : String!
title : String!
detail : String!
like_about: String
not_like_about: String
is_recommended: Int
}

input CustomerDataInput {
Expand Down

0 comments on commit c1cd48a

Please sign in to comment.