feat: PantryItem (Baslager) - tabell, backend-modul och frontend-sida

This commit is contained in:
Nils-Johan Gynther
2026-04-15 22:06:40 +02:00
parent 65ec74ac7d
commit 47d1aafd9e
12 changed files with 373 additions and 1 deletions
@@ -0,0 +1,13 @@
-- CreateTable
CREATE TABLE `PantryItem` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`productId` INTEGER NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
UNIQUE INDEX `PantryItem_productId_key`(`productId`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `PantryItem` ADD CONSTRAINT `PantryItem_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Product`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
+10 -1
View File
@@ -18,8 +18,9 @@ model Product {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
inventoryItems InventoryItem[]
inventoryItems InventoryItem[]
recipeIngredients RecipeIngredient[]
pantryItems PantryItem[]
}
model InventoryItem {
@@ -81,6 +82,14 @@ model RecipeIngredient {
unit String
note String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model PantryItem {
id Int @id @default(autoincrement())
productId Int @unique
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}