feat(graphql): добавить V2 GraphQL queries и resolvers для поставок расходников

Добавлены:
- seller-consumables-v2.ts - GraphQL queries для селлеров V2 системы
- seller-consumables.ts - resolver для работы с поставками расходников селлеров

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Veronika Smirnova
2025-08-25 23:06:10 +03:00
parent 57f8f762c9
commit 7f0e09eef6
2 changed files with 1021 additions and 0 deletions

View File

@ -0,0 +1,320 @@
// =============================================================================
// 📦 GraphQL ЗАПРОСЫ ДЛЯ СИСТЕМЫ ПОСТАВОК РАСХОДНИКОВ СЕЛЛЕРА V2
// =============================================================================
import { gql } from '@apollo/client'
// =============================================================================
// 🔍 QUERY - ПОЛУЧЕНИЕ ДАННЫХ
// =============================================================================
export const GET_MY_SELLER_CONSUMABLE_SUPPLIES = gql`
query GetMySellerConsumableSupplies {
mySellerConsumableSupplies {
id
status
sellerId
seller {
id
name
inn
}
fulfillmentCenterId
fulfillmentCenter {
id
name
inn
}
requestedDeliveryDate
notes
# Данные поставщика
supplierId
supplier {
id
name
inn
}
supplierApprovedAt
packagesCount
estimatedVolume
supplierContractId
supplierNotes
# Данные логистики
logisticsPartnerId
logisticsPartner {
id
name
inn
}
estimatedDeliveryDate
routeId
logisticsCost
logisticsNotes
# Данные отгрузки
shippedAt
trackingNumber
# Данные приемки
deliveredAt
receivedById
receivedBy {
id
managerName
phone
}
actualQuantity
defectQuantity
receiptNotes
# Экономика
totalCostWithDelivery
estimatedStorageCost
items {
id
productId
product {
id
name
article
price
quantity
mainImage
}
requestedQuantity
approvedQuantity
shippedQuantity
receivedQuantity
defectQuantity
unitPrice
totalPrice
}
createdAt
updatedAt
}
}
`
export const GET_SELLER_CONSUMABLE_SUPPLY = gql`
query GetSellerConsumableSupply($id: ID!) {
sellerConsumableSupply(id: $id) {
id
status
sellerId
seller {
id
name
inn
}
fulfillmentCenterId
fulfillmentCenter {
id
name
inn
}
requestedDeliveryDate
notes
# Данные поставщика
supplierId
supplier {
id
name
inn
}
supplierApprovedAt
packagesCount
estimatedVolume
supplierContractId
supplierNotes
# Данные логистики
logisticsPartnerId
logisticsPartner {
id
name
inn
}
estimatedDeliveryDate
routeId
logisticsCost
logisticsNotes
# Данные отгрузки
shippedAt
trackingNumber
# Данные приемки
deliveredAt
receivedById
receivedBy {
id
managerName
phone
}
actualQuantity
defectQuantity
receiptNotes
# Экономика
totalCostWithDelivery
estimatedStorageCost
items {
id
productId
product {
id
name
article
price
quantity
mainImage
}
requestedQuantity
approvedQuantity
shippedQuantity
receivedQuantity
defectQuantity
unitPrice
totalPrice
}
createdAt
updatedAt
}
}
`
// Для других типов организаций (фулфилмент, поставщики)
export const GET_INCOMING_SELLER_SUPPLIES = gql`
query GetIncomingSellerSupplies {
incomingSellerSupplies {
id
status
sellerId
seller {
id
name
inn
}
fulfillmentCenterId
fulfillmentCenter {
id
name
inn
}
requestedDeliveryDate
notes
supplierId
supplier {
id
name
inn
}
totalCostWithDelivery
items {
id
product {
id
name
article
}
requestedQuantity
unitPrice
totalPrice
}
createdAt
}
}
`
export const GET_MY_SELLER_SUPPLY_REQUESTS = gql`
query GetMySellerSupplyRequests {
mySellerSupplyRequests {
id
status
sellerId
seller {
id
name
inn
}
fulfillmentCenterId
fulfillmentCenter {
id
name
inn
}
requestedDeliveryDate
notes
totalCostWithDelivery
items {
id
product {
id
name
article
}
requestedQuantity
unitPrice
totalPrice
}
createdAt
}
}
`
// =============================================================================
// ✏️ MUTATIONS - ИЗМЕНЕНИЕ ДАННЫХ
// =============================================================================
export const CREATE_SELLER_CONSUMABLE_SUPPLY = gql`
mutation CreateSellerConsumableSupply($input: CreateSellerConsumableSupplyInput!) {
createSellerConsumableSupply(input: $input) {
success
message
supplyOrder {
id
status
createdAt
}
}
}
`
export const UPDATE_SELLER_SUPPLY_STATUS = gql`
mutation UpdateSellerSupplyStatus($id: ID!, $status: SellerSupplyOrderStatus!, $notes: String) {
updateSellerSupplyStatus(id: $id, status: $status, notes: $notes) {
id
status
updatedAt
supplierApprovedAt
shippedAt
deliveredAt
supplierNotes
receiptNotes
}
}
`
export const CANCEL_SELLER_SUPPLY = gql`
mutation CancelSellerSupply($id: ID!) {
cancelSellerSupply(id: $id) {
id
status
updatedAt
}
}
`