feat: enhance product model with subcategory, brand, tags, and nutrition; update related DTOs and services
This commit is contained in:
@@ -12,6 +12,8 @@ model Product {
|
||||
name String
|
||||
normalizedName String @unique
|
||||
category String?
|
||||
subcategory String?
|
||||
brand String?
|
||||
canonicalName String?
|
||||
isActive Boolean @default(true)
|
||||
deletedAt DateTime?
|
||||
@@ -22,6 +24,8 @@ model Product {
|
||||
recipeIngredients RecipeIngredient[]
|
||||
pantryItems PantryItem[]
|
||||
receiptAliases ReceiptAlias[]
|
||||
tags ProductTag[]
|
||||
nutrition Nutrition?
|
||||
}
|
||||
|
||||
model InventoryItem {
|
||||
@@ -115,4 +119,33 @@ model MealPlanEntry {
|
||||
|
||||
@@unique([date])
|
||||
@@index([date])
|
||||
}
|
||||
|
||||
model Tag {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
products ProductTag[]
|
||||
}
|
||||
|
||||
model ProductTag {
|
||||
productId Int
|
||||
tagId Int
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([productId, tagId])
|
||||
@@index([tagId])
|
||||
}
|
||||
|
||||
model Nutrition {
|
||||
id Int @id @default(autoincrement())
|
||||
productId Int @unique
|
||||
calories Float?
|
||||
protein Float?
|
||||
fat Float?
|
||||
carbohydrates Float?
|
||||
salt Float?
|
||||
sugar Float?
|
||||
fiber Float?
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
Reference in New Issue
Block a user