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

API: Product Reviews #55 #19266

Merged
merged 2 commits into from
Aug 17, 2020

Conversation

sky-hub
Copy link
Member

@sky-hub sky-hub commented Nov 18, 2018

Description (*)

Service contracts for product reviews.

As discussed with @paliarush, defined services are implemented similar to MSI implementation and allow bulk operations.
The difference in this implementation is that the service is returning a Response object containing success, failed, retryable object and errors associated to failed or retryable objects. Currently retyrable objects are not returned as I could not identify a specific error for this case (a database deadlock may be a case but furher research is needed)

  1. Added validation chain for review validate
  2. Added review aggregation service: app/code/Magento/Review/Model/Aggregator.php
  3. Updated method names to make them more specific and forwarded magic methods to new methods
    Ex: magic method $review->getStatusId() was forwarded to $review->getStatus()
  4. Some methods are not defined using strict types in order to keep backwards compatibility
  5. Added updated_at column for Review model
  6. Updated review tests
  7. Added support for extension attributes for reviews and related entities
  8. Added the possibility to save review ratings based on rating name and rating value. This was implemented to allow review ratings to be added without knowing the internal ids and also to align code base with the GraphQl implementation.

Notes:

  1. ReviewGraphQl module needs update after this PR is merged
  2. CreateReviews service can not be used to insert multiple reviews at the same time because review ratings need the reviewId when saving.
  3. Some methods can not enforce strict types as they need to remain backwards compatible

Fixed Issues (if relevant)

  1. API: Product Reviews community-features#55 - API: Product Reviews
  2. Product Review API #9570 - Product Review API

Manual testing scenarios (*)

  1. CREATE Reviews: make a post request to https://store.domain/rest/V1/create-reviews with the following data:
 {"reviews":[{"review_id":1,"related_entity_id":1,"review_entity_id":1,"customer_nickname":"Nickname","title":"Review Summary","review_text":"Review text","ratings":[{"rating_name":"Quality","rating_value":2},{"rating_name":"Price","rating_value":3}],"store_id":1,"stores":[1],"created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00"},{"review_id":2,"related_entity_id":1,"review_entity_id":1,"customer_nickname":"Nickname","title":"2 filter first review","review_text":"Review text","ratings":[{"rating_name":"Price","rating_value":3}],"store_id":1,"stores":[1],"created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00"}]}
  1. CREATE Reviews: make a post request to https://store.domain/rest/V1/create-reviews with the following data:
{"reviews":[{"review_id":1,"related_entity_id":1,"review_entity_id":1,"customer_nickname":"Updated Nickname","title":"Updated Review Summary","review_text":"Updated Review Text","ratings":[{"rating_name":"Quality","rating_value":2},{"rating_name":"Price","rating_value":3}],"store_id":1,"stores":[1],"created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00"},{"review_id":2,"related_entity_id":1,"review_entity_id":1,"customer_nickname":"Updated Customer Nickname","title":"Updated Review Title","review_text":"Updated Review Comment","ratings":[{"rating_name":"Price","rating_value":3}],"store_id":1,"stores":[1],"created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00"}]}
  1. GET Reviews: make a POST request to https://store.domain/rest/V1/get-reviews?searchCriteria[filterGroups][0][filters][0][field]=sku&searchCriteria[filterGroups][0][filters][0][value]='SOME-SKU'

  2. DELETE Reviews: make a POST request to https://store.domain/rest/V1/delete-reviews with the following data:

{"reviews":[{"review_id":1,"related_entity_id":1,"customer_nickname":"Nickname","title":"Review Summary","review_text":"Review text","created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00"},{"review_id":2,"related_entity_id":1,"customer_nickname":"Nickname","title":"2 filter first review","review_text":"Review text","created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00"}]}
  1. Related Links:

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 on Travis CI are green)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Nov 18, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @sky-hub. 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-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@okorshenko
Copy link
Contributor

okorshenko commented Nov 19, 2018

Hi @sky-hub
Could you please sign Contributor License Agreement so that we can proceed with PR review
https://cla.dev.magento.com/magento/magento2?pullRequest=19266

@sivaschenko sivaschenko self-assigned this Nov 19, 2018
@sky-hub
Copy link
Member Author

sky-hub commented Nov 19, 2018

Hi @sky-hub
Could you please sign Contributor License Agreement so that we can proceed with PR review
https://cla.dev.magento.com/magento/magento2?pullRequest=19266

Hello @okobchenko, sorry, fortgot about it. I would like to point that this PR is just a preview at what needs to be done on the long run. There is also the option to define APIs and implement them but I wouldn't take that approach since the current implementation is far from what it should be and most probably it would complicate things on long term if we keep postpone refactoring it.

I have added some TODOs where I considered that code needs to be updated.

@okorshenko okorshenko changed the title API: Product Reviews #55 [WIP] API: Product Reviews #55 Nov 19, 2018
@sivaschenko
Copy link
Member

Hi @sky-hub are you still working on this pull request? Please let us know when it's ready for review.

@nuzil
Copy link
Contributor

nuzil commented Dec 17, 2018

Hi @sivaschenko , @sky-hub needed some support to define main direction of current implementation. We had several talks with @paliarush and I guess now @sky-hub could proceed with this PR 👍

@sky-hub sky-hub force-pushed the api-product-reviews-55 branch 3 times, most recently from e644a30 to f7cffd5 Compare December 20, 2018 14:54
@sky-hub
Copy link
Member Author

sky-hub commented Dec 20, 2018

Due to holidays, etc, this PR is going to be put on hold until 15th of January 2019. I will continue working after that date.

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sky-hub thanks for the contribution! I've done a partial brief review at this point, however, as I can see there is still work to be done on this pull request. Please see my code review comments

@sidolov
Copy link
Contributor

sidolov commented Jan 22, 2019

Hi @sky-hub , are you still working on the pull request?

@sky-hub
Copy link
Member Author

sky-hub commented Jan 28, 2019

Hi @sky-hub , are you still working on the pull request?

Yes. Starting from today I will continue working on this pull request.

@sky-hub sky-hub force-pushed the api-product-reviews-55 branch from 66c2d8b to d7ff784 Compare January 29, 2019 20:18
@sky-hub sky-hub force-pushed the api-product-reviews-55 branch 2 times, most recently from 454aaf2 to 9156188 Compare February 10, 2019 22:17
@PiotrSiejczuk
Copy link

Hi @sky-hub are you still planning to continue the great work you are doing on this topic? I am currently facing a requirement @ one project to have such Reviews API in place. Would be good to know if you are planning to finish this PR :) Thank you in advance for your replay!

@sidolov sidolov changed the base branch from 2.3-develop to 2.4-develop December 5, 2019 17:21
@VladimirZaets VladimirZaets added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Jul 13, 2020
@lenaorobei
Copy link
Contributor

lenaorobei commented Aug 17, 2020

Unfortunately, due to changes in requirements this feature was implemented in the scope #27882 based on architectural design from magento/architecture#298.

@lenaorobei lenaorobei closed this Aug 17, 2020
@m2-assistant
Copy link

m2-assistant bot commented Aug 17, 2020

Hi @sky-hub, 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.

@lenaorobei lenaorobei reopened this Aug 17, 2020
@m2-assistant
Copy link

m2-assistant bot commented Aug 17, 2020

Hi @sky-hub. 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

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

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

@ghost ghost unassigned akaplya Aug 17, 2020
@lenaorobei lenaorobei changed the base branch from 2.4-develop to 2.4-develop-reviews August 17, 2020 19:20
@lenaorobei lenaorobei changed the base branch from 2.4-develop-reviews to product-reviews August 17, 2020 19:23
- resolve conflicts
@sidolov sidolov merged commit e80fe6a into magento:product-reviews Aug 17, 2020
@m2-assistant
Copy link

m2-assistant bot commented Aug 17, 2020

Hi @sky-hub, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Award: complex Award: special achievement Component: Review Release Line: 2.4 Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.