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

Wishlist Update schemas with UID changes #454

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 113 additions & 20 deletions design-documents/graph-ql/coverage/customer/Wishlist.graphqls
Original file line number Diff line number Diff line change
@@ -1,29 +1,52 @@
type Mutation {
createWishlist(name: String!): ID # Multiple wishlists Commerce functionality
removeWishlist(id: ID!): Boolean # Commerce fucntionality - in Opens Source we assume customer always has one wishlist
addProductsToWishlist(wishlistId: ID!, wishlistItems: [WishlistItemInput!]!): AddProductsToWishlistOutput
removeProductsFromWishlist(wishlistId: ID!, wishlistItemsIds: [ID!]!): RemoveProductsFromWishlistOutput
updateProductsInWishlist(wishlistId: ID!, wishlistItems: [WishlistItemUpdateInput!]!): UpdateProductsInWishlistOutput
createWishlist(input: CreateWishlistInput!): CreateWishlistOutput # Multiple wishlists Commerce functionality
cpartica marked this conversation as resolved.
Show resolved Hide resolved
deleteWishlist(wishlistUid: ID!): DeleteWishlistOutput # Commerce fucntionality - in Opens Source we assume customer always has one wishlist
addProductsToWishlist(wishlistUid: ID!, wishlistItems: [WishlistItemInput!]!): AddProductsToWishlistOutput
removeProductsFromWishlist(wishlistUid: ID!, wishlistItemsIds: [ID!]!): RemoveProductsFromWishlistOutput
updateProductsInWishlist(wishlistUid: ID!, wishlistItems: [WishlistItemUpdateInput!]!): UpdateProductsInWishlistOutput
copyProductsBetweenWishlists(sourceWishlistUid: ID!, destinationWishlistUid: ID!, wishlistItems: [WishlistItemCopyInput!]!): CopyProductsBetweenWishlistsOutput @doc(description: "Copy a product to the wish list")
moveProductsBetweenWishlists(sourceWishlistUid: ID!, destinationWishlistUid: ID!, wishlistItems: [WishlistItemMoveInput!]!): MoveProductsBetweenWishlistsOutput @doc(description: "Move products from one wish list to another")
updateWishlist( wishlistUid: ID!, input: UpdateWishlistInput!): UpdateWishlistOutput @doc(description: "Change the name and visibility of the specified wish list")
addWishlistItemsToCart(
wishlistUid: ID!, @doc(description: "unique Id of wishlist")
wishlistItemUids: [ID!] @doc(description: "Optional param. selected wish list items that are to be added")
): AddWishlistItemsToCartOutput @doc(description: "Add Requisition List Items To Customer Cart")
}

type Customer {
wishlist: Wishlist! @deprecated(reason: "Use `Customer.wishlists` or `Customer.wishlist_v2")
wishlist_v2(id: ID!): Wishlist # This query will be added in the ce
wishlist_v2(uid: ID!): Wishlist # This query will be added in the ce
Copy link
Member

Choose a reason for hiding this comment

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

We should just deprecate wishlist field and use new field wishlists, which will always have one item in Open Source.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@melnikovi I see, you have updated the schema file, Is there a need to do any additional changes to the schema file?

Copy link
Contributor

Choose a reason for hiding this comment

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

what he means here is we should either add wishlist_v3
However we decided to make id not required and add uid also as not required

wishlist_v2(id: ID, uid: ID) - in the code we will make at least 1 that's required but not through schema
adding wishlist_v3 for this is kind of intrusive.

wishlists: [Wishlist!]! @doc(description: "Customer wishlists are limited to a max of 1 wishlist in Magento Open Source") # This query will be added in the ce
}

type Wishlist {
id: ID
items: [WishlistItem] @deprecated(reason: "Use field `items_v3` from type `Wishlist` instead")
items_v2: [WishlistItemInterface] @doc(description: "An array of items in the customer's wishlist") @deprecated(reason: "Use field `items_v3` from type `Wishlist` instead")
items_v3(
currentPage: Int = 1 @doc(description: "current page of the customer wishlist items. default is 1")
pageSize: Int = 20 @doc(description: "page size for the customer wishlist items. default is 20")
): WishlistItems! @doc(description: "An array of items in the customer's wishlist")
uid: ID
items: [WishlistItem] @deprecated(reason: "Use field `items_v2` from type `Wishlist` instead")
items_v2(
currentPage: Int = 1,
pageSize: Int = 20
): WishlistItems @doc(description: "An array of items in the customer's wishlist")
items_count: Int
sharing_code: String
updated_at: String
name: String @doc(description: "Avaialble in Commerce edition only")
visibility: WishlistVisibilityEnum!
}

type WishlistItems {
items: [WishlistItemInterface]! @doc(description: "Wishlist items list")
page_info: SearchResultPageInfo
total_pages: Int! @doc(description: "total count of wishlist items")
}

input CreateWishlistInput {
name: String!
visibility: WishlistVisibilityEnum!
}

input UpdateWishlistInput {
name: String
visibility: WishlistVisibilityEnum
}

type WishlistItems {
Expand All @@ -33,8 +56,9 @@ type WishlistItems {
}

input WishlistItemUpdateInput {
wishlist_item_id: ID
Copy link
Contributor

Choose a reason for hiding this comment

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

we can't remove any of the existing fields, but deprecate them and also add wishlist_item_uid

wishlist_item_uid: ID!
quantity: Float
description: String
selected_options: [ID!]
entered_options: [EnteredOptionInput!]
}
Expand All @@ -44,24 +68,41 @@ type AddProductsToWishlistOutput {
}

type RemoveProductsFromWishlistOutput {
status: Boolean!
wishlist: Wishlist!
}

type UpdateProductsInWishlistOutput {
wishlist: Wishlist!
}

type AddWishlistItemsToCartOutput {
status: Boolean!
add_wishlist_items_to_cart_user_errors: [AddWishlistItemUserError]!
}

type AddWishlistItemUserError {
message: String!
type: AddWishlistItemUserErrorType!
}

enum AddWishlistItemUserErrorType {
OUT_OF_STOCK
MAX_QTY_FOR_USER
NOT_AVAILABLE
}

input WishlistItemInput {
sku: String
quantity: Float
sku: String!
quantity: Float!
parent_sku: String,
parent_quantity: Float,
selected_options: [ID!]
entered_options: [EnteredOptionInput!]
}

interface WishlistItemInterface {
id: ID
uid: ID
quantity: Float
description: String
added_at: String
Expand Down Expand Up @@ -90,10 +131,62 @@ type BundleWishlistItem implements WishlistItemInterface {
}

type GiftCardWishlistItem implements WishlistItemInterface {
sender_name: String!
sender_email: String!
gift_card_options: GiftCardOptions!
}

type GiftCardOptions {
sender_name: String
sender_email: String
recipient_name: String
recipient_email: String
amount: SelectedGiftCardAmount
amount: Money
custom_giftcard_amount: Money
message: String
}

type GroupedProductWishlistItem implements WishlistItemInterface {
grouped_products: [GroupedProductItem!]!
}

enum WishlistVisibilityEnum @doc(description: "This enumeration defines the wish list visibility types") {
PUBLIC
PRIVATE
}

type CreateWishlistOutput {
wishlist: Wishlist!
}

type DeleteWishlistOutput {
status: Boolean!
wishlists: [Wishlist!]!
}

input WishlistItemCopyInput {
wishlist_item_uid: ID! @doc(description: "The ID of the item to be copied")
quantity: Float @doc(description: "The quantity of this item to copy to the destination wish list. This value can't be greater than the quantity in the source wish list.")
}

input WishlistItemMoveInput {
wishlist_item_uid: ID! @doc(description: "The ID of the item to be moved")
quantity: Float @doc(description: "The quantity of this item to move to the destination wish list. This value can't be greater than the quantity in the source wish list.")
}

type UpdateWishlistOutput {
wishlist: Wishlist
}

type CopyProductsBetweenWishlistsOutput {
source_wishlist: Wishlist!
destination_wishlist: Wishlist!
}

type MoveProductsBetweenWishlistsOutput {
source_wishlist: Wishlist!
destination_wishlist: Wishlist!
}

type StoreConfig {
maximum_number_of_wishlists: Int @doc(description: "If multiple wish lists are enabled, the maximum number of wish lists the customer can have")
enable_multiple_wishlists: Boolean @doc(description: "Indicates whether customers can have multiple wish lists.")
}
8 changes: 4 additions & 4 deletions design-documents/graph-ql/coverage/customer/customer.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ type Mutation {
updateCustomer (input: CustomerInput!): CustomerOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomer") @doc(description:"Update the customer's personal information")
revokeCustomerToken: RevokeCustomerTokenOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\RevokeCustomerToken") @doc(description:"Revoke the customer token")
createCustomerAddress(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\CreateCustomerAddress") @doc(description: "Create customer address")
updateCustomerAddress(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomerAddress") @doc(description: "Update customer address")
deleteCustomerAddress(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\DeleteCustomerAddress") @doc(description: "Delete customer address")
updateCustomerAddress(uid: ID!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomerAddress") @doc(description: "Update customer address")
deleteCustomerAddress(uid: ID!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\DeleteCustomerAddress") @doc(description: "Delete customer address")
requestPasswordResetEmail(email: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\RequestPasswordResetEmail") @doc(description: "Request an email with a reset password token for the registered customer identified by the specified email.")
resetPassword(email: String!, resetPasswordToken: String!, newPassword: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\ResetPassword") @doc(description: "Reset a customer's password using the reset password token that the customer received in an email after requesting it using requestPasswordResetEmail.")
}
Expand Down Expand Up @@ -100,14 +100,14 @@ type Customer @doc(description: "Customer defines the customer name and address
dob: String @doc(description: "The customer's date of birth") @deprecated(reason: "Use `date_of_birth` instead")
date_of_birth: String @doc(description: "The customer's date of birth")
taxvat: String @doc(description: "The customer's Value-added tax (VAT) number (for corporate customers)")
id: Int @doc(description: "The ID assigned to the customer") @deprecated(reason: "id is not needed as part of Customer because on server side it can be identified based on customer token used for authentication. There is no need to know customer ID on the client side.")
uid: ID @doc(description: "The ID assigned to the customer") @deprecated(reason: "id is not needed as part of Customer because on server side it can be identified based on customer token used for authentication. There is no need to know customer ID on the client side.")
is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\IsSubscribed")
addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses") @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\CustomerAddresses")
gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)")
}

type CustomerAddress @doc(description: "CustomerAddress contains detailed information about a customer's billing and shipping addresses"){
id: Int @doc(description: "The ID assigned to the address object")
uid: ID @doc(description: "The ID assigned to the address object")
customer_id: Int @doc(description: "The customer ID") @deprecated(reason: "customer_id is not needed as part of CustomerAddress, address ID (id) is unique identifier for the addresses.")
region: CustomerAddressRegion @doc(description: "An object containing the region name, region code, and region ID")
region_id: Int @doc(description: "The unique ID for a pre-defined region") @deprecated(reason: "Use `region` instead.")
Expand Down
26 changes: 13 additions & 13 deletions design-documents/graph-ql/coverage/customer/gift-registry.graphqls
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type Customer {
gift_registry_list: [GiftRegistry]
gift_registry(id: ID!): GiftRegistry
Copy link
Contributor

Choose a reason for hiding this comment

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

we already took care of gift registy. please remove this scope from your PR

gift_registry(uid: ID!): GiftRegistry
}

type Query {
Expand All @@ -11,15 +11,15 @@ type Query {
giftRegistryTypeId: ID,
searchableDynamicAttributes: [GiftRegistryDynamicAttributeInput] @doc(description: "For select attributes ID should be provided expected. For range search, '_from' and '_to' suffixes can be added to the attribute code. For text attributes provide value for exact matching.")
): [GiftRegistry] @doc(description: "Gift registry search by registrant name and additional searchable attributes.")
giftRegistry(id: ID!): GiftRegistry @doc(description: "This query is intended for guests and some fields of GiftRegistry will not be availalbe")
giftRegistry(uid: ID!): GiftRegistry @doc(description: "This query is intended for guests and some fields of GiftRegistry will not be availalbe")
}

type Mutation {
# All mutations below should only be accessible to the registry owner. Guest users should be getting authorization error

createGiftRegistry(giftRegistry: CreateGiftRegistryInput!): CreateGiftRegistryOutput
updateGiftRegistry(id: ID!, giftRegistry: UpdateGiftRegistryInput!): UpdateGiftRegistryOutput
removeGiftRegistry(id: ID!): RemoveGiftRegistryOutput
updateGiftRegistry(uid: ID!, giftRegistry: UpdateGiftRegistryInput!): UpdateGiftRegistryOutput
removeGiftRegistry(uid: ID!): RemoveGiftRegistryOutput

addGiftRegistryItems(giftRegistryId: ID!, items: [AddGiftRegistryItemInput!]!): AddGiftRegistryItemsOutput
removeGiftRegistryItems(giftRegistryId: ID!, itemIds: [ID!]!): RemoveGiftRegistryItemsOutput
Expand All @@ -29,7 +29,7 @@ type Mutation {
updateGiftRegistryRegistrants(giftRegistryId: ID!, registrants: [UpdateGiftRegistryRegistrantInput!]!): UpdateGiftRegistryRegistrantsOutput
removeGiftRegistryRegistrants(giftRegistryId: ID!, registrantIds: [ID!]!): RemoveGiftRegistryRegistrantsOutput

shareGiftRegistry(id: ID!, sender: ShareGiftRegistrySenderInput!, invitees: [ShareGiftRegistryInviteeInput!]!): ShareGiftRegistryOutput
shareGiftRegistry(uid: ID!, sender: ShareGiftRegistrySenderInput!, invitees: [ShareGiftRegistryInviteeInput!]!): ShareGiftRegistryOutput
}

input ShareGiftRegistryInviteeInput
Expand Down Expand Up @@ -58,12 +58,12 @@ input AddGiftRegistryItemInput {

# Should be defined in scope of https://github.com/magento/architecture/blob/master/design-documents/graph-ql/coverage/add-items-to-cart-single-mutation.md
input EnteredOptionInput {
id: String!
uid: String!
value: String!
}

input UpdateGiftRegistryItemInput {
id: ID!
uid: ID!
quantity: Float!
note: String
}
Expand All @@ -79,7 +79,7 @@ input UpdateGiftRegistryInput {
}

input CreateGiftRegistryInput {
id: ID @doc(description: "Optional id, can be generated on the client and used for sending multiple gift-registry related mutations in a single request. For example, create registry and immediatly add items or registrants.")
uid: ID @doc(description: "Optional id, can be generated on the client and used for sending multiple gift-registry related mutations in a single request. For example, create registry and immediatly add items or registrants.")
event_name: String!
type_id: String!
message: String!
Expand All @@ -95,7 +95,7 @@ input GiftRegistryShippingAddressInput @doc(description: "Either address data or
}

input UpdateGiftRegistryRegistrantInput {
id: ID!
uid: ID!
first_name: String
last_name: String
email: String
Expand Down Expand Up @@ -155,7 +155,7 @@ type ShareGiftRegistryOutput {
}

type GiftRegistryType {
id: ID!
uid: ID!
label: String!
dynamic_attributes_metadata: [GiftRegistryDynamicAttributeMetadataInterface]
}
Expand Down Expand Up @@ -224,7 +224,7 @@ type GiftRegistrySelectAttributeOptionMetadata {
}

type GiftRegistry {
id: ID!
uid: ID!
event_name: String!
type: GiftRegistryType
message: String!
Expand All @@ -239,7 +239,7 @@ type GiftRegistry {
}

interface GiftRegistryItemInterface {
id: String!
uid: String!
quantity: Float!
quantity_fulfilled: Float!
note: String
Expand Down Expand Up @@ -301,7 +301,7 @@ enum GiftRegistryDynamicAttributeGroup {
}

type GiftRegistryRegistrant {
id: ID!
uid: ID!
first_name: String!
last_name: String!
email: String! @doc(description: "Accessible to the registry owner only")
Expand Down