Fix fulfillment consumables pricing architecture
- Add pricePerUnit field to Supply model for seller pricing - Fix updateSupplyPrice mutation to update pricePerUnit only - Separate purchase price (price) from selling price (pricePerUnit) - Fix GraphQL mutations to include organization field (CREATE/UPDATE_LOGISTICS) - Update GraphQL types to make Supply.price required again - Add comprehensive pricing rules to rules-complete.md sections 11.7.5 and 18.8 - Fix supplies-tab.tsx to show debug info and handle user loading Architecture changes: • Supply.price = purchase price from supplier (immutable) • Supply.pricePerUnit = selling price to sellers (mutable by fulfillment) • Warehouse shows purchase price only (readonly) • Services shows/edits selling price only 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -36,7 +36,7 @@ export const typeDefs = gql`
|
||||
|
||||
# Расходники селлеров (материалы клиентов)
|
||||
mySupplies: [Supply!]!
|
||||
|
||||
|
||||
# Доступные расходники для рецептур селлеров (только с ценой и в наличии)
|
||||
getAvailableSuppliesForRecipe: [SupplyForRecipe!]!
|
||||
|
||||
@ -522,25 +522,25 @@ export const typeDefs = gql`
|
||||
name: String!
|
||||
description: String
|
||||
# Новые поля для Services архитектуры
|
||||
pricePerUnit: Float # Цена за единицу для рецептур (может быть null)
|
||||
unit: String! # Единица измерения: "шт", "кг", "м"
|
||||
warehouseStock: Int! # Остаток на складе (readonly)
|
||||
isAvailable: Boolean! # Есть ли на складе (влияет на цвет)
|
||||
pricePerUnit: Float # Цена за единицу для рецептур (может быть null)
|
||||
unit: String! # Единица измерения: "шт", "кг", "м"
|
||||
warehouseStock: Int! # Остаток на складе (readonly)
|
||||
isAvailable: Boolean! # Есть ли на складе (влияет на цвет)
|
||||
warehouseConsumableId: ID! # Связь со складом
|
||||
# Поля из базы данных для обратной совместимости
|
||||
price: Float! # Из Prisma schema
|
||||
quantity: Int! # Из Prisma schema
|
||||
category: String! # Из Prisma schema
|
||||
status: String! # Из Prisma schema
|
||||
date: DateTime! # Из Prisma schema
|
||||
supplier: String! # Из Prisma schema
|
||||
minStock: Int! # Из Prisma schema
|
||||
currentStock: Int! # Из Prisma schema
|
||||
usedStock: Int! # Из Prisma schema
|
||||
type: String! # Из Prisma schema (SupplyType enum)
|
||||
sellerOwnerId: ID # Из Prisma schema
|
||||
sellerOwner: Organization # Из Prisma schema
|
||||
shopLocation: String # Из Prisma schema
|
||||
price: Float! # Цена закупки у поставщика (не меняется)
|
||||
quantity: Int! # Из Prisma schema
|
||||
category: String! # Из Prisma schema
|
||||
status: String! # Из Prisma schema
|
||||
date: DateTime! # Из Prisma schema
|
||||
supplier: String! # Из Prisma schema
|
||||
minStock: Int! # Из Prisma schema
|
||||
currentStock: Int! # Из Prisma schema
|
||||
usedStock: Int! # Из Prisma schema
|
||||
type: String! # Из Prisma schema (SupplyType enum)
|
||||
sellerOwnerId: ID # Из Prisma schema
|
||||
sellerOwner: Organization # Из Prisma schema
|
||||
shopLocation: String # Из Prisma schema
|
||||
imageUrl: String
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
@ -551,15 +551,15 @@ export const typeDefs = gql`
|
||||
type SupplyForRecipe {
|
||||
id: ID!
|
||||
name: String!
|
||||
pricePerUnit: Float! # Всегда не null
|
||||
pricePerUnit: Float! # Всегда не null
|
||||
unit: String!
|
||||
imageUrl: String
|
||||
warehouseStock: Int! # Всегда > 0
|
||||
warehouseStock: Int! # Всегда > 0
|
||||
}
|
||||
|
||||
# Для обновления цены расходника в разделе Услуги
|
||||
input UpdateSupplyPriceInput {
|
||||
pricePerUnit: Float # Может быть null (цена не установлена)
|
||||
pricePerUnit: Float # Может быть null (цена не установлена)
|
||||
}
|
||||
|
||||
input UseFulfillmentSuppliesInput {
|
||||
@ -567,7 +567,7 @@ export const typeDefs = gql`
|
||||
quantityUsed: Int!
|
||||
description: String # Описание использования (например, "Подготовка 300 продуктов")
|
||||
}
|
||||
|
||||
|
||||
# Устаревшие типы для обратной совместимости
|
||||
input SupplyInput {
|
||||
name: String!
|
||||
|
Reference in New Issue
Block a user