Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Product Reviews GraphQl support #27882

Merged

Conversation

eduard13
Copy link
Contributor

@eduard13 eduard13 commented Apr 17, 2020

Description (*)

This PR implements the Product Reviews GraphQl

Solution Architecture
#250

Related Pull Requests

https://github.com/magento/partners-magento2ee/pull/250
https://github.com/magento/partners-magento2-infrastructure/pull/7

Fixed Issues (if relevant)

  1. Catalog/Customer :: Product Reviews

Manual testing scenarios (*)

Product Query

Product reviews should be available for the Product query

{
  products(filter: {
      sku: {
          eq: "<sku>"
      }
  }) {
    items {
      rating_summary
      review_count
      reviews {
        items {
          nickname
          summary
          text
          average_rating
          product {
            sku
            name
          }
          ratings_breakdown {
            name
            value
          }
        }
      }
    }
  }
}

Product Review Rating Metadata Query

{
  productReviewRatingsMetadata {
    items {
      id
      name
      values {
        value_id
        value
      }
    }
  }
}

Customer Query

{
  customer {
    reviews {
      items {
        nickname
        summary
        text
        average_rating
        ratings_breakdown {
          name
          value
        }
      }
    }
  }
}

Create Product Review Mutation

mutation {
  createProductReview(
    input: {
      sku: "<sku>", 
      nickname: "<nickname>", 
      summary: "Summary Test", 
      text: "Text Test",
      ratings: [
        {
          id: "NA==",
          value_id: "MjA="
        }, {
          id: "MQ==", 
          value_id: "NQ=="
        }, {
          id: "Mw==", 
          value_id: "MTU="
        }
      ]
    }
) {
    review {
      nickname
      summary
      text
      average_rating
      ratings_breakdown {
        name
        value
      }
    }
  }
}

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Apr 17, 2020

Hi @eduard13. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@ghost ghost added this to Pending Review in Pull Requests Dashboard Apr 17, 2020
@magento-engcom-team magento-engcom-team added Component: ReviewGraphQl Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Apr 17, 2020
@eduard13 eduard13 marked this pull request as draft April 17, 2020 12:09
@eduard13 eduard13 changed the title [WIP] Adding Reviews GraphQl support [WIP] Adding Product Reviews GraphQl support Apr 17, 2020
@eduard13 eduard13 added the WIP Work In Progress label Apr 17, 2020
@rogyar rogyar self-assigned this Apr 17, 2020
@rogyar rogyar self-requested a review April 18, 2020 05:55
@ghost ghost moved this from Pending Review to Changes Requested in Pull Requests Dashboard Apr 18, 2020
@ghost ghost assigned eduard13 Apr 21, 2020
@rogyar rogyar self-requested a review April 24, 2020 13:42
@eduard13
Copy link
Contributor Author

@rogyar the suggestions have been applied.
Thank you.

@rogyar rogyar changed the title [WIP] Adding Product Reviews GraphQl support Adding Product Reviews GraphQl support Apr 27, 2020
@rogyar rogyar marked this pull request as ready for review April 27, 2020 10:27
@rogyar rogyar self-requested a review April 27, 2020 10:27
@rogyar rogyar added Award: category of expertise Award: special achievement Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests Award: complex and removed WIP Work In Progress labels Apr 27, 2020
@ghost ghost moved this from Waiting Related PRs to Ready for Testing in Pull Requests Dashboard Jul 9, 2020
@ghost ghost assigned cpartica Jul 9, 2020
@dthampy dthampy moved this from Ready for Testing to Testing in Progress in Pull Requests Dashboard Jul 9, 2020
@ghost ghost moved this from Testing in Progress to Merge in Progress in Pull Requests Dashboard Jul 9, 2020
@prabhuram93
Copy link
Contributor

@magento run all tests

1 similar comment
@prabhuram93
Copy link
Contributor

@magento run all tests

@m2-assistant
Copy link

m2-assistant bot commented Jul 15, 2020

Hi @eduard13, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ghost ghost moved this from Merge in Progress to Recently Merged in Pull Requests Dashboard Jul 15, 2020
@lenaorobei lenaorobei mentioned this pull request Aug 17, 2020
4 tasks
@huykon
Copy link

huykon commented Aug 25, 2020

can I use pagination for reviews graphql ?

@nrkapoor
Copy link

@huykon
Copy link

huykon commented Aug 25, 2020

@nrkapoor thanks you. I found that

@huykon
Copy link

huykon commented Sep 8, 2020

@nrkapoor I can not mutation to create new review if user login. what is the nickname if user loged In?

@prabhuram93
Copy link
Contributor

@huykon Can you provide more details about the error you are getting? Thanks!

@huykon
Copy link

huykon commented Sep 8, 2020

@prabhuram93 I set don't allow guest to create review into admin dashboard and now in mutation create review, what can I push to nickname param?

@prabhuram93
Copy link
Contributor

Screen Shot 2020-09-08 at 11 25 54 AM

Nickname is the name which the user wishes to use for the review. For a logged in customer, it can default to the customer's name, still he can have an option to change it.

@eduard13 eduard13 deleted the feature/review-graphql-261 branch September 8, 2020 18:07
@huykon
Copy link

huykon commented Sep 9, 2020

@prabhuram93 That's good. I forgot bearer token with customer logged in situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Pull Requests Dashboard
  
Recently Merged
Development

Successfully merging this pull request may close these issues.

Catalog/Customer :: Product Reviews