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:
Veronika Smirnova
2025-08-07 14:33:40 +03:00
parent cd7dcd9333
commit 0304f69410
6 changed files with 371 additions and 54 deletions

View File

@ -203,7 +203,8 @@ model Supply {
id String @id @default(cuid())
name String
description String?
price Decimal @db.Decimal(10, 2)
price Decimal @db.Decimal(10, 2) // Цена закупки у поставщика (не меняется)
pricePerUnit Decimal? @db.Decimal(10, 2) // Цена продажи селлерам (устанавливается фулфилментом)
quantity Int @default(0)
unit String @default("шт")
category String @default("Расходники")