-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[GraphQl][Wishlist] Implementing a new Query of getting customer wishlist #29148
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
[GraphQl][Wishlist] Implementing a new Query of getting customer wishlist #29148
Conversation
Hi @eduard13. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
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. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
The general idea looks good to me. But before jumping into details, I believe the schema/architecture should be approved by @paliarush. Alex, could you share your thoughts, please, on this implementation? |
@rogyar I believe the changes were approved but we still need to merge the architecture PR. @DrewML @paliarush can you merge the PR? |
Apologies for the lag - architecture PR here magento/architecture#403 |
array $args = null | ||
) { | ||
if (!$this->wishlistConfig->isEnabled()) { | ||
throw new GraphQlInputException(__('The wishlist is not currently available.')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend some more meaningful explanation here. Otherwise, it might sound like EntityNotFound issue for some particular wishlist.
$collection->setPageSize($pageSize); | ||
} | ||
|
||
$result = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend using more specific names for variables
$result = []; | |
$wishlists = []; |
Hi @eduard13. Please, check my minor recommendations above. Thank you. |
@magento run all tests |
1 similar comment
@magento run all tests |
Hi @rogyar, your suggestions have been implemented. |
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly changing "wishlist to wish list", since that's how it's spelled in the Admin and Luma
wishlists( | ||
pageSize: Int = 20 @doc(description: "Specifies the maximum number of results to return at once. This attribute is optional."), | ||
currentPage: Int = 1 @doc(description: "Specifies which page of results to return. The default value is 1.") | ||
): [Wishlist!]! @doc(description: "An array of wishlists. In Magento Open Source, customers are limited to one wishlist. The number of wishlists is not restricted for Magento Commerce") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
): [Wishlist!]! @doc(description: "An array of wishlists. In Magento Open Source, customers are limited to one wishlist. The number of wishlists is not restricted for Magento Commerce") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists") | |
): [Wishlist!]! @doc(description: "An array of wishlists. In Magento Open Source, customers are limited to one wish list. The number of wish lists is configurable for Magento Commerce") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists") |
currentPage: Int = 1 @doc(description: "Specifies which page of results to return. The default value is 1.") | ||
): [Wishlist!]! @doc(description: "An array of wishlists. In Magento Open Source, customers are limited to one wishlist. The number of wishlists is not restricted for Magento Commerce") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists") | ||
wishlist: Wishlist! @deprecated(reason: "Use `Customer.wishlists` or `Customer.wishlist_v2`") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlistResolver") @doc(description: "Contains a customer's wish lists") @cache(cacheable: false) | ||
wishlist_v2(id: ID!): Wishlist @doc(description: "Retrieve the specified wishlist") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistById") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wishlist_v2(id: ID!): Wishlist @doc(description: "Retrieve the specified wishlist") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistById") | |
wishlist_v2(id: ID!): Wishlist @doc(description: "Retrieve the specified wish list") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistById") |
@@ -492,3 +492,9 @@ type StoreConfig @doc(description: "The type contains information about a store | |||
catalog_default_sort_by : String @doc(description: "Default Sort By.") | |||
root_category_id: Int @doc(description: "The ID of the root category") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\RootCategoryId") | |||
} | |||
|
|||
type SimpleWishlistItem implements WishlistItemInterface @doc(description: "A simple product wishlist Item") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type SimpleWishlistItem implements WishlistItemInterface @doc(description: "A simple product wishlist Item") { | |
type SimpleWishlistItem implements WishlistItemInterface @doc(description: "A simple product wish list item") { |
type SimpleWishlistItem implements WishlistItemInterface @doc(description: "A simple product wishlist Item") { | ||
} | ||
|
||
type VirtualWishlistItem implements WishlistItemInterface @doc(description: "A virtual product wishlist item") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type VirtualWishlistItem implements WishlistItemInterface @doc(description: "A virtual product wishlist item") { | |
type VirtualWishlistItem implements WishlistItemInterface @doc(description: "A virtual product wish list item") { |
@@ -68,3 +68,8 @@ type SelectedConfigurableOption { | |||
value_id: Int! | |||
value_label: String! | |||
} | |||
|
|||
type ConfigurableWishlistItem implements WishlistItemInterface @doc(description: "A configurable product wishlist item"){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type ConfigurableWishlistItem implements WishlistItemInterface @doc(description: "A configurable product wishlist item"){ | |
type ConfigurableWishlistItem implements WishlistItemInterface @doc(description: "A configurable product wish list item"){ |
@@ -64,3 +64,8 @@ type DownloadableProductSamples @doc(description: "DownloadableProductSamples de | |||
sample_type: DownloadableFileTypeEnum @deprecated(reason: "`sample_url` serves to get the downloadable sample") | |||
sample_file: String @deprecated(reason: "`sample_url` serves to get the downloadable sample") | |||
} | |||
|
|||
type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "A downloadable product wishlist item") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "A downloadable product wishlist item") { | |
type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "A downloadable product wish list item") { |
@keharper I added your suggestions and linked infra PR. |
@magento run all tests |
Hi @eduard13, thank you for your contribution! |
Description (*)
This PR is a follow up of the following discussion, that is supposed to introduce a new Query, that will return the customer wishlists.
For
CE
version, it will always return a single wishlist (as there is no possibility to create more wishlists), so probably it doesn't make sense to implement any kind of logic to limit it to just 1 result. What do you think?Related Pull Requests
https://github.com/magento/partners-magento2-infrastructure/pull/26
Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
Get Customer's wishlist
Get Customer's wishlist (
wishlist_v2
)Questions or comments
The new Query will also be working for Multiple Wishlists, that will return all the customer's wishlists. Additionally it supports pagination, that may be used in EE version.
cc. @nrkapoor, @DrewML, @prabhuram93
Contribution checklist (*)