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] Visitor and Customer add ProductReview #12472

Merged
merged 6 commits into from Mar 29, 2021

Conversation

Tomanhez
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
License MIT

@Tomanhez Tomanhez added Feature New feature proposals. API APIs related issues and PRs. labels Mar 23, 2021
@Tomanhez Tomanhez requested a review from a team as a code owner March 23, 2021 08:21
@Tomanhez Tomanhez force-pushed the product-review-api branch 2 times, most recently from e3c9fd5 to 422af47 Compare March 23, 2021 19:58
@Tomanhez Tomanhez changed the title [Api] Visitor add ProductReview [Api] Visitor and Customer add ProductReview Mar 23, 2021
@Tomanhez Tomanhez force-pushed the product-review-api branch 4 times, most recently from cb09ff4 to 2e9a709 Compare March 23, 2021 20:22
Copy link
Contributor

@AdamKasp AdamKasp left a comment

Choose a reason for hiding this comment

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

And when you making a big refactor (not directly related with scop of task), I suggest making it in separate PR, because the majority of this code is a refactor not a feature :)

@Tomanhez Tomanhez force-pushed the product-review-api branch 2 times, most recently from ee6b994 to 89ebd17 Compare March 24, 2021 11:59
src/Sylius/Behat/Context/Api/Shop/ProductReviewContext.php Outdated Show resolved Hide resolved
public function iWantToReviewProduct(ProductInterface $product): void
{
$this->client->buildCreateRequest();
$this->client->addRequestData('productCode', $product->getCode());
Copy link
Member

Choose a reason for hiding this comment

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

In my previous review, I wrote that we need to keep a product code on command instead of iri, but we still should pass to the endpoint an iri as the resource identifier for API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solution for it: #12487

@Tomanhez Tomanhez force-pushed the product-review-api branch 2 times, most recently from 932b0a3 to 62b66d3 Compare March 25, 2021 16:23
$this->productRepository = $productRepository;
}

public function __invoke(AddProductReview $addProductReview): ReviewInterface
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking about this return type. I just checked few handlers and all of them returns void. So is it really needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Command AddProductReview create new ReviewInterface. Its useful to return ReviewInterface as a Response.

Copy link
Member

Choose a reason for hiding this comment

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

it is needed if we want to return 201 and created object. But not sure if this is case here

Copy link
Contributor Author

@Tomanhez Tomanhez Mar 29, 2021

Choose a reason for hiding this comment

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

If I add void, as a response I get object of AddProductReview and 201 code. Its needed? Do user should know structure of this object? This is the intention creating ReviewInterface object and it should return this object as a response. IMO

And for example: If I create new 'Review' object, and if I need to get it, I need call to next response as a get on item just to know my new created object, Its needed?

));
}

function it_throws_an_exception_if_email_has_not_been_found(
Copy link
Member

Choose a reason for hiding this comment

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

we are missing a nulled mail path coverage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it not the same case? Is only one way. You must have email, If not its throw exception.

@Tomanhez Tomanhez force-pushed the product-review-api branch 2 times, most recently from ad20b82 to 46891a2 Compare March 29, 2021 11:07
@probot-autolabeler probot-autolabeler bot added the Maintenance CI configurations, READMEs, releases, etc. label Mar 29, 2021
@GSadee GSadee merged commit 17f8807 into Sylius:master Mar 29, 2021
@GSadee
Copy link
Member

GSadee commented Mar 29, 2021

Thanks, Tomasz! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs. Feature New feature proposals. Maintenance CI configurations, READMEs, releases, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants