Persist user carts in database

This commit is contained in:
Ruslan Bakiev
2026-04-04 09:08:42 +07:00
parent 6ea9d4e5b7
commit b01b2421b5
4 changed files with 338 additions and 0 deletions

View File

@@ -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!