feat(backend): Abfuellungen und Produkte (Modul 23)
ProductsModule (GET/POST /products, GET/PATCH /products/:id) und BottlingModule (GET/POST /bottling-batches) mit transaktionaler Reduzierung der HoneyBatch-Restmenge beim Abfuellen; Ablehnung bei Abfuellmenge > verfuegbarer Menge. Neue Prisma-Modelle Product und BottlingBatch (Migration bottling_products).
This commit is contained in:
1 parent
8b7fd61c1c
commit
e82cae257b
17 files changed
+916
-2
No files matched your search
@@ -49,6 +49,7 @@ model User {
|
||||
createdTasks Task[] @relation("TaskCreator")
|
||||
colonyMoves ColonyApiaryHistory[]
|
||||
auditLogs AuditLog[]
|
||||
bottlingBatches BottlingBatch[]
|
||||
|
||||
@@index([role])
|
||||
}
|
||||
@@ -528,7 +529,8 @@ model HoneyBatch {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
measurements HoneyMeasurement[]
|
||||
measurements HoneyMeasurement[]
|
||||
bottlingBatches BottlingBatch[]
|
||||
|
||||
@@index([status])
|
||||
@@index([extractionId])
|
||||
@@ -624,3 +626,49 @@ model StockMovement {
|
||||
|
||||
@@index([stockItemId, date])
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Abfüllungen und Produkte (Abschnitt 4.19, 4.20) – v1.x Modul 23
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
enum ProductStatus {
|
||||
ACTIVE
|
||||
DISCONTINUED
|
||||
}
|
||||
|
||||
model Product {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
description String?
|
||||
sku String? @unique
|
||||
packagingSize Float?
|
||||
weight Float?
|
||||
salesUnit String?
|
||||
status ProductStatus @default(ACTIVE)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
bottlingBatches BottlingBatch[]
|
||||
|
||||
@@index([status])
|
||||
}
|
||||
|
||||
model BottlingBatch {
|
||||
id String @id @default(cuid())
|
||||
honeyBatchId String
|
||||
honeyBatch HoneyBatch @relation(fields: [honeyBatchId], references: [id])
|
||||
productId String?
|
||||
product Product? @relation(fields: [productId], references: [id])
|
||||
date DateTime
|
||||
jarSize Float
|
||||
jarCount Int
|
||||
totalAmount Float
|
||||
bestBeforeDate DateTime
|
||||
lotNumber String @unique
|
||||
userId String?
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([honeyBatchId])
|
||||
@@index([productId])
|
||||
}
|
||||
Reference in new issue
Block a user