feat: implement user-specific inventory management with security checks
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-07 11:58:00 +02:00
parent 4affb03504
commit 17893824d5
8 changed files with 181 additions and 31 deletions
+4
View File
@@ -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])
}