Files
recipe-app/backend/prisma/schema.prisma
T
Nils-Johan Gynther 73bf5193c4 feat: add image handling to recipes
- Implemented image downloading and optimization in QuickImportService.
- Added imageUrl field to CreateRecipeDto for recipe creation.
- Created an endpoint in RecipesController to update recipe images.
- Enhanced RecipesService to handle image URL updates and optimizations.
- Updated Docker Compose to mount a volume for recipe images.
- Refactored frontend to display images in recipe grids and detail views.
- Added a new utility function for downloading and optimizing images.
- Created a new API route for handling image uploads.
- Introduced RecipeGrid component for better recipe display.
- Updated RecipeDetailClient to manage image updates and display.
- Added migration for new imageUrl column in the Recipe table.
2026-04-15 19:46:50 +02:00

86 lines
2.3 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model Product {
id Int @id @default(autoincrement())
name String
normalizedName String @unique
category String?
canonicalName String?
isActive Boolean @default(true)
deletedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
inventoryItems InventoryItem[]
recipeIngredients RecipeIngredient[]
}
model InventoryItem {
id Int @id @default(autoincrement())
productId Int
quantity Decimal @db.Decimal(10, 2)
unit String
brand String?
location String?
priority Int?
purchaseDate DateTime?
opened Boolean?
shelfNote String?
suitableFor String?
isOnSale Boolean?
priceLevel Int?
bestBeforeDate DateTime?
proteinType String?
isLeftover Boolean?
comment String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
consumptions InventoryConsumption[]
@@index([productId])
}
model InventoryConsumption {
id Int @id @default(autoincrement())
inventoryItem InventoryItem @relation(fields: [inventoryItemId], references: [id])
inventoryItemId Int
amountUsed Decimal @db.Decimal(10, 2)
comment String?
createdAt DateTime @default(now())
}
model Recipe {
id Int @id @default(autoincrement())
name String
description String?
instructions String? @db.Text
imageUrl String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
ingredients RecipeIngredient[]
}
model RecipeIngredient {
id Int @id @default(autoincrement())
recipe Recipe @relation(fields: [recipeId], references: [id])
recipeId Int
product Product @relation(fields: [productId], references: [id])
productId Int
quantity Decimal @db.Decimal(10, 2)
unit String
note String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}