feat: add generated code

This commit is contained in:
aid-orchestrator
2026-05-12 09:31:32 +00:00
parent 62b4b052a3
commit 12179f2160
51 changed files with 1143 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
enum MovementKind {
Receipt
Issue
Transfer
Adjustment
}
model ProductType {
id String @id @default(uuid())
name String @unique
products Product[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("product_types")
}
model Product {
id String @id @default(uuid())
name String
productType ProductType @relation(fields: [productTypeId], references: [id])
productTypeId String
parent Product? @relation("ProductHierarchy", fields: [parentId], references: [id])
parentId String?
children Product[] @relation("ProductHierarchy")
stockStatus StockStatus?
lines StockMovementLine[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("products")
}
model StockStatus {
product Product @relation(fields: [productId], references: [id])
productId String @id @unique
quantity Decimal @default(0)
inStock Boolean @default(false)
updatedAt DateTime @default(now()) @updatedAt
@@map("stock_statuses")
}
model StockMovement {
id String @id @default(uuid())
documentDate DateTime @db.Date
kind MovementKind
lines StockMovementLine[]
comment String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("stock_movements")
}
model StockMovementLine {
id String @id @default(uuid())
product Product @relation(fields: [productId], references: [id])
productId String
quantity Decimal
inStock Boolean
movement StockMovement @relation(fields: [movementId], references: [id])
movementId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([movementId, productId])
@@map("stock_movement_lines")
}