feat: implement user-specific inventory management with security checks
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -25,6 +25,7 @@ model User {
|
||||
ownedRecipes Recipe[] @relation("RecipeOwner")
|
||||
sharedRecipes RecipeShare[]
|
||||
ownedProducts Product[]
|
||||
inventoryItems InventoryItem[]
|
||||
pantryItems PantryItem[]
|
||||
mealPlanEntries MealPlanEntry[]
|
||||
receiptAliases ReceiptAlias[]
|
||||
@@ -91,6 +92,7 @@ model UserProduct {
|
||||
|
||||
model InventoryItem {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
productId Int
|
||||
quantity Decimal @db.Decimal(10, 2)
|
||||
unit String
|
||||
@@ -107,9 +109,11 @@ model InventoryItem {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
consumptions InventoryConsumption[]
|
||||
|
||||
@@index([userId])
|
||||
@@index([productId])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user