Back cart with GraphQL storage
This commit is contained in:
18
graphql/operations/cart/add-product-to-cart.graphql
Normal file
18
graphql/operations/cart/add-product-to-cart.graphql
Normal file
@@ -0,0 +1,18 @@
|
||||
mutation AddProductToCart($productId: ID!) {
|
||||
addProductToCart(productId: $productId) {
|
||||
id
|
||||
userId
|
||||
deliveryAddressId
|
||||
items {
|
||||
id
|
||||
productId
|
||||
productName
|
||||
sku
|
||||
isCustomizable
|
||||
quantity
|
||||
parameters
|
||||
updatedAt
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
18
graphql/operations/cart/clear-cart.graphql
Normal file
18
graphql/operations/cart/clear-cart.graphql
Normal file
@@ -0,0 +1,18 @@
|
||||
mutation ClearCart {
|
||||
clearCart {
|
||||
id
|
||||
userId
|
||||
deliveryAddressId
|
||||
items {
|
||||
id
|
||||
productId
|
||||
productName
|
||||
sku
|
||||
isCustomizable
|
||||
quantity
|
||||
parameters
|
||||
updatedAt
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
18
graphql/operations/cart/my-cart.graphql
Normal file
18
graphql/operations/cart/my-cart.graphql
Normal file
@@ -0,0 +1,18 @@
|
||||
query MyCart {
|
||||
myCart {
|
||||
id
|
||||
userId
|
||||
deliveryAddressId
|
||||
items {
|
||||
id
|
||||
productId
|
||||
productName
|
||||
sku
|
||||
isCustomizable
|
||||
quantity
|
||||
parameters
|
||||
updatedAt
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
18
graphql/operations/cart/remove-cart-item.graphql
Normal file
18
graphql/operations/cart/remove-cart-item.graphql
Normal file
@@ -0,0 +1,18 @@
|
||||
mutation RemoveCartItem($productId: ID!) {
|
||||
removeCartItem(productId: $productId) {
|
||||
id
|
||||
userId
|
||||
deliveryAddressId
|
||||
items {
|
||||
id
|
||||
productId
|
||||
productName
|
||||
sku
|
||||
isCustomizable
|
||||
quantity
|
||||
parameters
|
||||
updatedAt
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
18
graphql/operations/cart/set-cart-delivery-address.graphql
Normal file
18
graphql/operations/cart/set-cart-delivery-address.graphql
Normal file
@@ -0,0 +1,18 @@
|
||||
mutation SetCartDeliveryAddress($addressId: ID) {
|
||||
setCartDeliveryAddress(addressId: $addressId) {
|
||||
id
|
||||
userId
|
||||
deliveryAddressId
|
||||
items {
|
||||
id
|
||||
productId
|
||||
productName
|
||||
sku
|
||||
isCustomizable
|
||||
quantity
|
||||
parameters
|
||||
updatedAt
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
18
graphql/operations/cart/update-cart-item-quantity.graphql
Normal file
18
graphql/operations/cart/update-cart-item-quantity.graphql
Normal file
@@ -0,0 +1,18 @@
|
||||
mutation UpdateCartItemQuantity($input: UpdateCartItemQuantityInput!) {
|
||||
updateCartItemQuantity(input: $input) {
|
||||
id
|
||||
userId
|
||||
deliveryAddressId
|
||||
items {
|
||||
id
|
||||
productId
|
||||
productName
|
||||
sku
|
||||
isCustomizable
|
||||
quantity
|
||||
parameters
|
||||
updatedAt
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
@@ -191,6 +191,28 @@ type Product {
|
||||
availableInWarehouses: [ProductWarehouseBalance!]!
|
||||
}
|
||||
|
||||
type CartItem {
|
||||
id: ID!
|
||||
productId: ID!
|
||||
productName: String!
|
||||
sku: String!
|
||||
isCustomizable: Boolean!
|
||||
quantity: Float!
|
||||
parameters: JSON!
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
}
|
||||
|
||||
type Cart {
|
||||
id: ID!
|
||||
userId: ID!
|
||||
deliveryAddressId: ID
|
||||
deliveryAddress: DeliveryAddress
|
||||
items: [CartItem!]!
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
}
|
||||
|
||||
type OrderItem {
|
||||
id: ID!
|
||||
productId: ID
|
||||
@@ -266,6 +288,7 @@ type Query {
|
||||
healthcheck: String!
|
||||
me: User
|
||||
myCounterpartyProfile: CounterpartyProfile
|
||||
myCart: Cart!
|
||||
myDeliveryAddresses: [DeliveryAddress!]!
|
||||
myMessengerConnections: [MessengerConnection!]!
|
||||
myNotificationHistory(channel: MessengerType!, limit: Int = 50): [NotificationHistoryItem!]!
|
||||
@@ -340,6 +363,11 @@ input CreateMyDeliveryAddressInput {
|
||||
fiasId: String
|
||||
}
|
||||
|
||||
input UpdateCartItemQuantityInput {
|
||||
productId: ID!
|
||||
quantity: Float!
|
||||
}
|
||||
|
||||
input ReadyOrderItemInput {
|
||||
productId: ID!
|
||||
quantity: Float!
|
||||
@@ -400,6 +428,11 @@ type Mutation {
|
||||
acceptInvitation(input: AcceptInvitationInput!): User!
|
||||
connectMessenger(input: ConnectMessengerInput!): MessengerConnection!
|
||||
upsertMyCounterpartyProfile(input: UpsertMyCounterpartyProfileInput!): CounterpartyProfile!
|
||||
addProductToCart(productId: ID!): Cart!
|
||||
updateCartItemQuantity(input: UpdateCartItemQuantityInput!): Cart!
|
||||
removeCartItem(productId: ID!): Cart!
|
||||
setCartDeliveryAddress(addressId: ID): Cart!
|
||||
clearCart: Cart!
|
||||
createMyDeliveryAddress(input: CreateMyDeliveryAddressInput!): DeliveryAddress!
|
||||
setMyDefaultDeliveryAddress(addressId: ID!): DeliveryAddress!
|
||||
deleteMyDeliveryAddress(addressId: ID!): Boolean!
|
||||
|
||||
Reference in New Issue
Block a user