Добавлены модели и мутации для управления заказами поставок расходников. Обновлены схемы GraphQL с новыми типами и полями для SupplyOrder и SupplyOrderItem. Реализована логика создания заказов поставок с соответствующими полями и статусами. Обновлены компоненты интерфейса для улучшения навигации и взаимодействия с новыми функциями.

This commit is contained in:
Veronika Smirnova
2025-07-21 12:45:11 +03:00
parent 39c1499f72
commit 96a328b3ac
7 changed files with 2982 additions and 1680 deletions

View File

@ -97,6 +97,8 @@ model Organization {
supplies Supply[]
users User[]
logistics Logistics[]
supplyOrders SupplyOrder[]
partnerSupplyOrders SupplyOrder[] @relation("SupplyOrderPartner")
@@map("organizations")
}
@ -229,6 +231,7 @@ model Product {
organizationId String
cartItems CartItem[]
favorites Favorites[]
supplyOrderItems SupplyOrderItem[]
category Category? @relation(fields: [categoryId], references: [id])
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
@ -363,6 +366,14 @@ enum ScheduleStatus {
ABSENT
}
enum SupplyOrderStatus {
PENDING
CONFIRMED
IN_TRANSIT
DELIVERED
CANCELLED
}
model Logistics {
id String @id @default(cuid())
fromLocation String
@ -377,3 +388,36 @@ model Logistics {
@@map("logistics")
}
model SupplyOrder {
id String @id @default(cuid())
partnerId String
deliveryDate DateTime
status SupplyOrderStatus @default(PENDING)
totalAmount Decimal @db.Decimal(12, 2)
totalItems Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
organizationId String
items SupplyOrderItem[]
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
partner Organization @relation("SupplyOrderPartner", fields: [partnerId], references: [id])
@@map("supply_orders")
}
model SupplyOrderItem {
id String @id @default(cuid())
supplyOrderId String
productId String
quantity Int
price Decimal @db.Decimal(12, 2)
totalPrice Decimal @db.Decimal(12, 2)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
supplyOrder SupplyOrder @relation(fields: [supplyOrderId], references: [id], onDelete: Cascade)
product Product @relation(fields: [productId], references: [id])
@@unique([supplyOrderId, productId])
@@map("supply_order_items")
}