inventory1

This commit is contained in:
2026-03-14 21:10:35 -05:00
parent df3f1412f6
commit d21e2e3c0b
21 changed files with 1492 additions and 7 deletions

View File

@@ -101,6 +101,24 @@ model FileAttachment {
companyLogoFor CompanyProfile? @relation("CompanyLogo")
}
model InventoryItem {
id String @id @default(cuid())
sku String @unique
name String
description String
type String
status String
unitOfMeasure String
isSellable Boolean @default(true)
isPurchasable Boolean @default(true)
defaultCost Float?
notes String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
bomLines InventoryBomLine[] @relation("InventoryBomParent")
usedInBomLines InventoryBomLine[] @relation("InventoryBomComponent")
}
model Customer {
id String @id @default(cuid())
name String
@@ -134,6 +152,23 @@ model Customer {
childCustomers Customer[] @relation("CustomerHierarchy")
}
model InventoryBomLine {
id String @id @default(cuid())
parentItemId String
componentItemId String
quantity Float
unitOfMeasure String
notes String
position Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
parentItem InventoryItem @relation("InventoryBomParent", fields: [parentItemId], references: [id], onDelete: Cascade)
componentItem InventoryItem @relation("InventoryBomComponent", fields: [componentItemId], references: [id], onDelete: Restrict)
@@index([parentItemId, position])
@@index([componentItemId])
}
model Vendor {
id String @id @default(cuid())
name String