Files
sfera-new/src/graphql/queries/seller-consumables-v2.ts
Veronika Smirnova 65fba5d911 feat: завершить полную миграцию кабинета поставщика V1→V2
Полностью мигрирован кабинет поставщика /wholesale/orders на V2 архитектуру:
- Создан supplier-orders-tabs-v2.tsx с 3 V2 источниками данных
- Удалены устаревшие V1 компоненты (supplier-orders-tabs.tsx, supplier-orders-content.tsx, supplier-order-card.tsx)
- Исправлены React Hooks Order ошибки и GraphQL поля
- Реализована умная маршрутизация действий по типу поставки
- Добавлены V2 мутации для редактирования параметров
- Сохранен 100% оригинальный визуал и функционал
- Создана документация миграции
- Исправлены все ESLint ошибки для чистого кода

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 00:10:55 +03:00

321 lines
5.9 KiB
TypeScript

// =============================================================================
// 📦 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
# Данные приемки
receivedAt
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
# Данные приемки
receivedAt
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
receivedAt
supplierNotes
receiptNotes
}
}
`
export const CANCEL_SELLER_SUPPLY = gql`
mutation CancelSellerSupply($id: ID!) {
cancelSellerSupply(id: $id) {
id
status
updatedAt
}
}
`