feat: catalogo+30, varianti, sostituti, reintroduzione Fase 2, free meal Fase 3 (PRD §5.1)
Quattro completamenti del PRD §5.1: catalogo, varianti/sostituti, fase 2,
free meal.
Catalogo ricette 16 → 46
- seed-recipes.ts: +30 ricette italiane keto bilanciate
(8 colazione · 8 pranzo · 6 spuntino · 8 cena)
- seed-ingredients.ts: 33 → 55 ingredienti
(verdura/carne/pesce/latticini/condimenti + categorie nuove `legumi` e
`cereali` per Fase 2)
- seed.ts: ora fa upsert anche degli ingredienti pre-esistenti per
propagare campi nuovi (es. phase2Week)
Varianti + sostituti
- Recipe.variants Json (array { name, description, kcalDelta? })
- RecipeIngredient.substitutes String[]
- /recipes/[id]: nuova sezione "Varianti suggerite" + riga "Sostituzioni:"
sotto ogni ingrediente quando presenti
Reintroduzione progressiva Fase 2
- Ingredient.phase2Week (settimana minima di reintroduzione, NULL=sempre)
- User.phase2StartedAt: settato automaticamente quando si passa a TRANSITION
- @ketopath/shared/planner/phase-progression: currentPhase2Week,
isRecipeAllowedForPhaseWeek, weeksSince
- plan.routes filtra fuori le ricette con ingredienti non ancora reintrodotti
- POST /me/profile/phase per avanzare di fase (idempotente sul timestamp)
- 12 unit test su phase-progression
- Esempi seed: lenticchie phase2Week=3, ceci=4, mela=5, pera=6, quinoa=7
Free Meal pianificato Fase 3
- MealSlot.isFreeMeal Boolean (default false)
- POST /me/meal-plans/slots/:id/free-meal toggle, valido solo in MAINTENANCE
- @ketopath/shared/planner/phase-progression: freeMealKcalAdjustment
(compensazione clamp -200/+50 kcal per pasto sui rimanenti)
- /plan: bottone ☆ in ogni SlotCard quando phase=MAINTENANCE; lo slot
marcato come pasto libero rende "Pasto libero pianificato" + ~750 kcal
stimate; macro tracker ne tiene conto
Indicatori di fase nel piano
- /plan ora include currentPhase + phase2Week dalla API
- Header del piano: "Settimana N di Fase 2" o "Mantenimento — Fase 3"
i18n: namespaces Plan + Recipe arricchiti
Schema migration 20260429XXXXXX_add_meal_plan_extras.
66/66 unit test verdi (12 nuovi). Smoke verificato live: API ritorna
correctly i campi nuovi, UI rende badge fase, bottoni ☆/↻, free-meal slot.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2c11b73703
commit
bda96a3550
15 files changed
+1288
-44
No files matched your search
@@ -0,0 +1,14 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "ingredients" ADD COLUMN "phase2_week" INTEGER;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "meal_slots" ADD COLUMN "is_free_meal" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "recipe_ingredients" ADD COLUMN "substitutes" TEXT[] DEFAULT ARRAY[]::TEXT[];
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "recipes" ADD COLUMN "variants" JSONB NOT NULL DEFAULT '[]';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "users" ADD COLUMN "phase2_started_at" TIMESTAMP(3);
|
||||
@@ -86,6 +86,9 @@ model User {
|
||||
// PRD §14.3 — consenso esplicito al disclaimer medico. NULL finché l'utente
|
||||
// non lo accetta; bloccante per le pagine di profilo/tracking.
|
||||
disclaimerAcceptedAt DateTime? @map("disclaimer_accepted_at")
|
||||
// PRD §5.1 — momento in cui l'utente è entrato nella fase 2 (TRANSITION).
|
||||
// Serve a calcolare la "settimana di fase" per la reintroduzione progressiva.
|
||||
phase2StartedAt DateTime? @map("phase2_started_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -282,6 +285,9 @@ model Ingredient {
|
||||
netCarbPer100g Float @map("net_carb_per_100g")
|
||||
exclusionGroups String[] @default([]) @map("exclusion_groups")
|
||||
priceAvgEur Float? @map("price_avg_eur")
|
||||
// PRD §5.1 — settimana di Fase 2 dalla quale l'ingrediente diventa
|
||||
// disponibile (1=da subito, 5=quinta settimana, ecc.). NULL = sempre.
|
||||
phase2Week Int? @map("phase2_week")
|
||||
|
||||
recipeIngredients RecipeIngredient[]
|
||||
|
||||
@@ -304,6 +310,9 @@ model Recipe {
|
||||
phases Int[] @default([1, 2, 3])
|
||||
servings Int @default(1)
|
||||
notesChef String? @map("notes_chef")
|
||||
// PRD §5.1 — varianti della ricetta (es. "versione vegetariana"). Array
|
||||
// JSON di { name, description, kcalDelta? }. Schema applicativo zod-validato.
|
||||
variants Json @default("[]")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -316,11 +325,14 @@ model Recipe {
|
||||
}
|
||||
|
||||
model RecipeIngredient {
|
||||
id String @id @default(cuid())
|
||||
recipeId String @map("recipe_id")
|
||||
ingredientId String @map("ingredient_id")
|
||||
id String @id @default(cuid())
|
||||
recipeId String @map("recipe_id")
|
||||
ingredientId String @map("ingredient_id")
|
||||
quantity Float
|
||||
unit String
|
||||
// PRD §5.1 — suggerimenti di sostituzione per quell'ingrediente in questa
|
||||
// ricetta. Stringhe libere ("ricotta intera", "tofu strapazzato"…).
|
||||
substitutes String[] @default([])
|
||||
|
||||
recipe Recipe @relation(fields: [recipeId], references: [id], onDelete: Cascade)
|
||||
ingredient Ingredient @relation(fields: [ingredientId], references: [id])
|
||||
@@ -372,12 +384,16 @@ model DeviceToken {
|
||||
}
|
||||
|
||||
model MealSlot {
|
||||
id String @id @default(cuid())
|
||||
planId String @map("plan_id")
|
||||
dayOfWeek Int @map("day_of_week")
|
||||
meal MealCategory
|
||||
recipeId String? @map("recipe_id")
|
||||
status String @default("pending")
|
||||
id String @id @default(cuid())
|
||||
planId String @map("plan_id")
|
||||
dayOfWeek Int @map("day_of_week")
|
||||
meal MealCategory
|
||||
recipeId String? @map("recipe_id")
|
||||
status String @default("pending")
|
||||
// PRD §5.1 — "pasto libero" pianificato in Fase 3. Quando true, lo slot
|
||||
// è un placeholder (no ricetta KetoPath, kcal stimate ~750) e il piano
|
||||
// adatta gli altri pasti della settimana.
|
||||
isFreeMeal Boolean @default(false) @map("is_free_meal")
|
||||
|
||||
plan MealPlan @relation(fields: [planId], references: [id], onDelete: Cascade)
|
||||
selected Recipe? @relation("SelectedRecipe", fields: [recipeId], references: [id])
|
||||
|
||||
@@ -15,7 +15,9 @@ export interface SeedIngredient {
|
||||
| 'panetteria'
|
||||
| 'frutta-secca'
|
||||
| 'erbe'
|
||||
| 'salumi';
|
||||
| 'salumi'
|
||||
| 'legumi'
|
||||
| 'cereali';
|
||||
defaultUnit: 'g' | 'ml' | 'pz' | 'cucchiaio' | 'cucchiaino';
|
||||
kcalPer100g: number;
|
||||
proteinPer100g: number;
|
||||
@@ -23,6 +25,8 @@ export interface SeedIngredient {
|
||||
netCarbPer100g: number;
|
||||
exclusionGroups: string[];
|
||||
priceAvgEur?: number;
|
||||
// PRD §5.1 — settimana di Fase 2 dalla quale è disponibile (1+).
|
||||
phase2Week?: number;
|
||||
}
|
||||
|
||||
export const SEED_INGREDIENTS: SeedIngredient[] = [
|
||||
@@ -398,4 +402,259 @@ export const SEED_INGREDIENTS: SeedIngredient[] = [
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 5.0,
|
||||
},
|
||||
// VERDURA — extra
|
||||
{
|
||||
name: 'Broccoli',
|
||||
category: 'verdura',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 34,
|
||||
proteinPer100g: 2.8,
|
||||
fatPer100g: 0.4,
|
||||
netCarbPer100g: 4.0,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 2.0,
|
||||
},
|
||||
{
|
||||
name: 'Funghi champignon',
|
||||
category: 'verdura',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 22,
|
||||
proteinPer100g: 3.1,
|
||||
fatPer100g: 0.3,
|
||||
netCarbPer100g: 2.3,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 4.5,
|
||||
},
|
||||
{
|
||||
name: 'Spinaci surgelati',
|
||||
category: 'verdura',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 23,
|
||||
proteinPer100g: 3.0,
|
||||
fatPer100g: 0.4,
|
||||
netCarbPer100g: 1.5,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 1.5,
|
||||
},
|
||||
{
|
||||
name: 'Melanzane',
|
||||
category: 'verdura',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 25,
|
||||
proteinPer100g: 1.0,
|
||||
fatPer100g: 0.2,
|
||||
netCarbPer100g: 3.0,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 2.0,
|
||||
},
|
||||
{
|
||||
name: 'Peperoni',
|
||||
category: 'verdura',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 31,
|
||||
proteinPer100g: 1.0,
|
||||
fatPer100g: 0.3,
|
||||
netCarbPer100g: 4.6,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 2.8,
|
||||
},
|
||||
// CARNE & PESCE — extra
|
||||
{
|
||||
name: 'Petto di tacchino',
|
||||
category: 'carne',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 135,
|
||||
proteinPer100g: 30,
|
||||
fatPer100g: 1.0,
|
||||
netCarbPer100g: 0,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 12.0,
|
||||
},
|
||||
{
|
||||
name: 'Gamberi',
|
||||
category: 'pesce',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 99,
|
||||
proteinPer100g: 24,
|
||||
fatPer100g: 0.3,
|
||||
netCarbPer100g: 0.2,
|
||||
exclusionGroups: ['fish'],
|
||||
priceAvgEur: 18.0,
|
||||
},
|
||||
{
|
||||
name: 'Sgombro',
|
||||
category: 'pesce',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 205,
|
||||
proteinPer100g: 19,
|
||||
fatPer100g: 14,
|
||||
netCarbPer100g: 0,
|
||||
exclusionGroups: ['fish'],
|
||||
priceAvgEur: 12.0,
|
||||
},
|
||||
{
|
||||
name: 'Prosciutto crudo',
|
||||
category: 'salumi',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 270,
|
||||
proteinPer100g: 27,
|
||||
fatPer100g: 18,
|
||||
netCarbPer100g: 0,
|
||||
exclusionGroups: ['pork'],
|
||||
priceAvgEur: 32.0,
|
||||
},
|
||||
{
|
||||
name: 'Bresaola',
|
||||
category: 'salumi',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 151,
|
||||
proteinPer100g: 33,
|
||||
fatPer100g: 2.0,
|
||||
netCarbPer100g: 0,
|
||||
exclusionGroups: ['beef'],
|
||||
priceAvgEur: 38.0,
|
||||
},
|
||||
// LATTICINI — extra
|
||||
{
|
||||
name: 'Mozzarella di bufala',
|
||||
category: 'latticini',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 288,
|
||||
proteinPer100g: 17,
|
||||
fatPer100g: 24,
|
||||
netCarbPer100g: 0.4,
|
||||
exclusionGroups: ['lactose'],
|
||||
priceAvgEur: 14.0,
|
||||
},
|
||||
{
|
||||
name: 'Stracchino',
|
||||
category: 'latticini',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 298,
|
||||
proteinPer100g: 18,
|
||||
fatPer100g: 25,
|
||||
netCarbPer100g: 1.0,
|
||||
exclusionGroups: ['lactose'],
|
||||
priceAvgEur: 12.0,
|
||||
},
|
||||
{
|
||||
name: 'Mascarpone',
|
||||
category: 'latticini',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 429,
|
||||
proteinPer100g: 4.8,
|
||||
fatPer100g: 44,
|
||||
netCarbPer100g: 4.8,
|
||||
exclusionGroups: ['lactose'],
|
||||
priceAvgEur: 8.0,
|
||||
},
|
||||
// CONDIMENTI / SEMI — extra
|
||||
{
|
||||
name: 'Aceto balsamico',
|
||||
category: 'condimenti',
|
||||
defaultUnit: 'cucchiaio',
|
||||
kcalPer100g: 88,
|
||||
proteinPer100g: 0.5,
|
||||
fatPer100g: 0,
|
||||
netCarbPer100g: 17,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 8.0,
|
||||
},
|
||||
{
|
||||
name: 'Semi di chia',
|
||||
category: 'frutta-secca',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 486,
|
||||
proteinPer100g: 17,
|
||||
fatPer100g: 31,
|
||||
netCarbPer100g: 1.4,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 18.0,
|
||||
},
|
||||
{
|
||||
name: 'Cocco rapè non zuccherato',
|
||||
category: 'frutta-secca',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 660,
|
||||
proteinPer100g: 7,
|
||||
fatPer100g: 64,
|
||||
netCarbPer100g: 7,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 10.0,
|
||||
},
|
||||
// FRUTTA — phase2-introduced
|
||||
{
|
||||
name: 'Frutti di bosco misti',
|
||||
category: 'frutta',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 47,
|
||||
proteinPer100g: 0.9,
|
||||
fatPer100g: 0.3,
|
||||
netCarbPer100g: 7,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 8.0,
|
||||
phase2Week: 1, // disponibile da subito anche in fase 2 (low-carb)
|
||||
},
|
||||
{
|
||||
name: 'Mela',
|
||||
category: 'frutta',
|
||||
defaultUnit: 'pz',
|
||||
kcalPer100g: 52,
|
||||
proteinPer100g: 0.3,
|
||||
fatPer100g: 0.2,
|
||||
netCarbPer100g: 11,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 2.5,
|
||||
phase2Week: 5, // si reintroduce dalla 5ª settimana di fase 2
|
||||
},
|
||||
{
|
||||
name: 'Pera',
|
||||
category: 'frutta',
|
||||
defaultUnit: 'pz',
|
||||
kcalPer100g: 57,
|
||||
proteinPer100g: 0.4,
|
||||
fatPer100g: 0.1,
|
||||
netCarbPer100g: 12,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 2.8,
|
||||
phase2Week: 6,
|
||||
},
|
||||
// LEGUMI — phase2-introduced
|
||||
{
|
||||
name: 'Lenticchie cotte',
|
||||
category: 'legumi',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 116,
|
||||
proteinPer100g: 9,
|
||||
fatPer100g: 0.4,
|
||||
netCarbPer100g: 12,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 2.5,
|
||||
phase2Week: 3,
|
||||
},
|
||||
{
|
||||
name: 'Ceci cotti',
|
||||
category: 'legumi',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 164,
|
||||
proteinPer100g: 9,
|
||||
fatPer100g: 2.6,
|
||||
netCarbPer100g: 17,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 2.5,
|
||||
phase2Week: 4,
|
||||
},
|
||||
// CEREALI — phase2-introduced (avanzato)
|
||||
{
|
||||
name: 'Quinoa cotta',
|
||||
category: 'cereali',
|
||||
defaultUnit: 'g',
|
||||
kcalPer100g: 120,
|
||||
proteinPer100g: 4.4,
|
||||
fatPer100g: 1.9,
|
||||
netCarbPer100g: 18,
|
||||
exclusionGroups: [],
|
||||
priceAvgEur: 6.0,
|
||||
phase2Week: 7,
|
||||
},
|
||||
];
|
||||
@@ -316,4 +316,537 @@ export const SEED_RECIPES: SeedRecipe[] = [
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
// ─── Espansione catalogo ──────────────────────────────────────────────
|
||||
// COLAZIONE
|
||||
{
|
||||
name: 'Pancake proteici alla cannella',
|
||||
category: 'COLAZIONE',
|
||||
description: 'Tre pancake con uova, ricotta e cannella. Senza farina.',
|
||||
prepMinutes: 10,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 350,
|
||||
proteinG: 26,
|
||||
fatG: 22,
|
||||
netCarbG: 5,
|
||||
phases: [1, 2, 3],
|
||||
notesChef: 'Per dolcezza naturale aggiungi qualche frutto di bosco da fase 2.',
|
||||
ingredients: [
|
||||
{ name: 'Uova', quantity: 2, unit: 'pz' },
|
||||
{ name: 'Ricotta vaccina', quantity: 60, unit: 'g' },
|
||||
{ name: 'Cannella in polvere', quantity: 1, unit: 'cucchiaino' },
|
||||
{ name: 'Burro', quantity: 5, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Smoothie verde con avocado e spinaci',
|
||||
category: 'COLAZIONE',
|
||||
description: 'Spinaci, mezzo avocado, yogurt greco e semi di chia frullati.',
|
||||
prepMinutes: 5,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 340,
|
||||
proteinG: 14,
|
||||
fatG: 24,
|
||||
netCarbG: 8,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Spinaci freschi', quantity: 50, unit: 'g' },
|
||||
{ name: 'Avocado', quantity: 0.5, unit: 'pz' },
|
||||
{ name: 'Yogurt greco intero', quantity: 100, unit: 'g' },
|
||||
{ name: 'Semi di chia', quantity: 10, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Uova alla coque con bresaola',
|
||||
category: 'COLAZIONE',
|
||||
description: 'Due uova alla coque con 30 g di bresaola e olio EVO.',
|
||||
prepMinutes: 8,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 280,
|
||||
proteinG: 28,
|
||||
fatG: 17,
|
||||
netCarbG: 1,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Uova', quantity: 2, unit: 'pz' },
|
||||
{ name: 'Bresaola', quantity: 30, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 0.5, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Yogurt greco con frutti di bosco e semi',
|
||||
category: 'COLAZIONE',
|
||||
description: 'Yogurt greco intero, mirtilli e lamponi, semi di chia.',
|
||||
prepMinutes: 3,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 260,
|
||||
proteinG: 17,
|
||||
fatG: 13,
|
||||
netCarbG: 12,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Yogurt greco intero', quantity: 200, unit: 'g' },
|
||||
{ name: 'Frutti di bosco misti', quantity: 50, unit: 'g' },
|
||||
{ name: 'Semi di chia', quantity: 10, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Frittatina ai funghi e prezzemolo',
|
||||
category: 'COLAZIONE',
|
||||
description: 'Due uova con champignon trifolati e prezzemolo.',
|
||||
prepMinutes: 12,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 290,
|
||||
proteinG: 22,
|
||||
fatG: 21,
|
||||
netCarbG: 3,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Uova', quantity: 2, unit: 'pz' },
|
||||
{ name: 'Funghi champignon', quantity: 80, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Avocado con uovo strapazzato',
|
||||
category: 'COLAZIONE',
|
||||
description: 'Mezzo avocado svuotato e farcito con un uovo strapazzato.',
|
||||
prepMinutes: 7,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 320,
|
||||
proteinG: 13,
|
||||
fatG: 26,
|
||||
netCarbG: 4,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Avocado', quantity: 0.5, unit: 'pz' },
|
||||
{ name: 'Uova', quantity: 1, unit: 'pz' },
|
||||
{ name: 'Burro', quantity: 5, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Mascarpone con noci e cocco',
|
||||
category: 'COLAZIONE',
|
||||
description: 'Mascarpone leggero con noci tritate e cocco rapè.',
|
||||
prepMinutes: 3,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 380,
|
||||
proteinG: 7,
|
||||
fatG: 36,
|
||||
netCarbG: 6,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Mascarpone', quantity: 60, unit: 'g' },
|
||||
{ name: 'Noci', quantity: 15, unit: 'g' },
|
||||
{ name: 'Cocco rapè non zuccherato', quantity: 10, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Omelette con prosciutto e mozzarella',
|
||||
category: 'COLAZIONE',
|
||||
description: 'Tre uova con prosciutto crudo e mozzarella di bufala.',
|
||||
prepMinutes: 10,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 460,
|
||||
proteinG: 32,
|
||||
fatG: 35,
|
||||
netCarbG: 2,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Uova', quantity: 3, unit: 'pz' },
|
||||
{ name: 'Prosciutto crudo', quantity: 30, unit: 'g' },
|
||||
{ name: 'Mozzarella di bufala', quantity: 40, unit: 'g' },
|
||||
],
|
||||
},
|
||||
// PRANZO
|
||||
{
|
||||
name: 'Tacchino con broccoli al vapore',
|
||||
category: 'PRANZO',
|
||||
description: 'Petto di tacchino alla piastra con broccoli e olio EVO.',
|
||||
prepMinutes: 20,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 410,
|
||||
proteinG: 42,
|
||||
fatG: 22,
|
||||
netCarbG: 6,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Petto di tacchino', quantity: 150, unit: 'g' },
|
||||
{ name: 'Broccoli', quantity: 200, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1.5, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Insalata di sgombro e olive',
|
||||
category: 'PRANZO',
|
||||
description: 'Insalata mista, sgombro al naturale, olive nere, capperi.',
|
||||
prepMinutes: 8,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 480,
|
||||
proteinG: 30,
|
||||
fatG: 36,
|
||||
netCarbG: 5,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Sgombro', quantity: 130, unit: 'g' },
|
||||
{ name: 'Insalata mista', quantity: 100, unit: 'g' },
|
||||
{ name: 'Olive nere', quantity: 25, unit: 'g' },
|
||||
{ name: 'Capperi sotto sale', quantity: 1, unit: 'cucchiaio' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Pollo al limone con asparagi',
|
||||
category: 'PRANZO',
|
||||
description: 'Petto di pollo marinato al limone con asparagi al forno.',
|
||||
prepMinutes: 22,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 470,
|
||||
proteinG: 40,
|
||||
fatG: 28,
|
||||
netCarbG: 6,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Petto di pollo', quantity: 150, unit: 'g' },
|
||||
{ name: 'Asparagi', quantity: 180, unit: 'g' },
|
||||
{ name: 'Limone', quantity: 0.5, unit: 'pz' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1.5, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Caprese con bufala e pomodorini',
|
||||
category: 'PRANZO',
|
||||
description: 'Mozzarella di bufala con pomodorini, basilico e olio EVO.',
|
||||
prepMinutes: 6,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 500,
|
||||
proteinG: 25,
|
||||
fatG: 40,
|
||||
netCarbG: 6,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Mozzarella di bufala', quantity: 125, unit: 'g' },
|
||||
{ name: 'Pomodorini ciliegino', quantity: 150, unit: 'g' },
|
||||
{ name: 'Basilico fresco', quantity: 10, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1.5, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Insalata di gamberi e avocado',
|
||||
category: 'PRANZO',
|
||||
description: 'Gamberi al vapore, avocado, rucola e limone.',
|
||||
prepMinutes: 15,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 420,
|
||||
proteinG: 28,
|
||||
fatG: 28,
|
||||
netCarbG: 5,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Gamberi', quantity: 150, unit: 'g' },
|
||||
{ name: 'Avocado', quantity: 0.5, unit: 'pz' },
|
||||
{ name: 'Rucola', quantity: 60, unit: 'g' },
|
||||
{ name: 'Limone', quantity: 0.5, unit: 'pz' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Carpaccio di bresaola con grana',
|
||||
category: 'PRANZO',
|
||||
description: 'Bresaola con scaglie di grana, rucola e limone.',
|
||||
prepMinutes: 5,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 360,
|
||||
proteinG: 38,
|
||||
fatG: 22,
|
||||
netCarbG: 2,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Bresaola', quantity: 80, unit: 'g' },
|
||||
{ name: 'Grana Padano', quantity: 25, unit: 'g' },
|
||||
{ name: 'Rucola', quantity: 50, unit: 'g' },
|
||||
{ name: 'Limone', quantity: 0.5, unit: 'pz' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Frittata di melanzane',
|
||||
category: 'PRANZO',
|
||||
description: 'Frittata con melanzane grigliate e parmigiano.',
|
||||
prepMinutes: 25,
|
||||
difficulty: 'MEDIA',
|
||||
kcal: 450,
|
||||
proteinG: 26,
|
||||
fatG: 33,
|
||||
netCarbG: 6,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Uova', quantity: 3, unit: 'pz' },
|
||||
{ name: 'Melanzane', quantity: 150, unit: 'g' },
|
||||
{ name: 'Parmigiano Reggiano', quantity: 25, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1.5, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Insalata di lenticchie e tonno',
|
||||
category: 'PRANZO',
|
||||
description: "Lenticchie cotte con tonno sott'olio, pomodorini e prezzemolo.",
|
||||
prepMinutes: 10,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 430,
|
||||
proteinG: 32,
|
||||
fatG: 18,
|
||||
netCarbG: 22,
|
||||
phases: [2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Lenticchie cotte', quantity: 130, unit: 'g' },
|
||||
{ name: "Tonno sott'olio", quantity: 100, unit: 'g' },
|
||||
{ name: 'Pomodorini ciliegino', quantity: 80, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
// SPUNTINO
|
||||
{
|
||||
name: 'Noci e cubetti di parmigiano',
|
||||
category: 'SPUNTINO',
|
||||
description: 'Mix di noci e cubetti di parmigiano stagionato.',
|
||||
prepMinutes: 1,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 200,
|
||||
proteinG: 11,
|
||||
fatG: 15,
|
||||
netCarbG: 2,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Noci', quantity: 15, unit: 'g' },
|
||||
{ name: 'Parmigiano Reggiano', quantity: 25, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Stracchino con cetrioli',
|
||||
category: 'SPUNTINO',
|
||||
description: 'Stracchino spalmato su bastoncini di cetriolo.',
|
||||
prepMinutes: 3,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 130,
|
||||
proteinG: 7,
|
||||
fatG: 10,
|
||||
netCarbG: 3,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Stracchino', quantity: 40, unit: 'g' },
|
||||
{ name: 'Cetrioli', quantity: 100, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Frutti di bosco con cocco',
|
||||
category: 'SPUNTINO',
|
||||
description: 'Frutti di bosco freschi cosparsi di cocco rapè.',
|
||||
prepMinutes: 2,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 110,
|
||||
proteinG: 1,
|
||||
fatG: 7,
|
||||
netCarbG: 9,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Frutti di bosco misti', quantity: 80, unit: 'g' },
|
||||
{ name: 'Cocco rapè non zuccherato', quantity: 10, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Prosciutto crudo e mozzarella',
|
||||
category: 'SPUNTINO',
|
||||
description: 'Fettina di prosciutto crudo arrotolata su mozzarella.',
|
||||
prepMinutes: 1,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 180,
|
||||
proteinG: 14,
|
||||
fatG: 13,
|
||||
netCarbG: 1,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Prosciutto crudo', quantity: 30, unit: 'g' },
|
||||
{ name: 'Mozzarella di bufala', quantity: 40, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Mela e mandorle',
|
||||
category: 'SPUNTINO',
|
||||
description: 'Mezza mela a spicchi con mandorle al naturale.',
|
||||
prepMinutes: 2,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 160,
|
||||
proteinG: 4,
|
||||
fatG: 10,
|
||||
netCarbG: 13,
|
||||
phases: [2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Mela', quantity: 0.5, unit: 'pz' },
|
||||
{ name: 'Mandorle', quantity: 15, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Hummus di ceci con verdure crude',
|
||||
category: 'SPUNTINO',
|
||||
description: 'Crema di ceci con bastoncini di sedano e peperoni.',
|
||||
prepMinutes: 5,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 170,
|
||||
proteinG: 6,
|
||||
fatG: 10,
|
||||
netCarbG: 14,
|
||||
phases: [2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Ceci cotti', quantity: 60, unit: 'g' },
|
||||
{ name: 'Peperoni', quantity: 80, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
// CENA
|
||||
{
|
||||
name: 'Sgombro al cartoccio con melanzane',
|
||||
category: 'CENA',
|
||||
description: 'Sgombro intero al cartoccio con melanzane e pomodorini.',
|
||||
prepMinutes: 30,
|
||||
difficulty: 'MEDIA',
|
||||
kcal: 510,
|
||||
proteinG: 32,
|
||||
fatG: 38,
|
||||
netCarbG: 6,
|
||||
phases: [1, 2, 3],
|
||||
notesChef: 'Cottura 20 min a 200°C. Se ti piace lo zenzero, aggiunto crudo è perfetto.',
|
||||
ingredients: [
|
||||
{ name: 'Sgombro', quantity: 200, unit: 'g' },
|
||||
{ name: 'Melanzane', quantity: 150, unit: 'g' },
|
||||
{ name: 'Pomodorini ciliegino', quantity: 80, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1.5, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Tagliolini di zucchine al pesto',
|
||||
category: 'CENA',
|
||||
description: 'Zucchine spiralizzate con pesto fresco di basilico e pinoli.',
|
||||
prepMinutes: 15,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 380,
|
||||
proteinG: 12,
|
||||
fatG: 32,
|
||||
netCarbG: 8,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Zucchine', quantity: 250, unit: 'g' },
|
||||
{ name: 'Basilico fresco', quantity: 20, unit: 'g' },
|
||||
{ name: 'Parmigiano Reggiano', quantity: 20, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 2, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Pollo al curry con cavolfiore',
|
||||
category: 'CENA',
|
||||
description: 'Bocconcini di pollo al curry con cavolfiore "riso".',
|
||||
prepMinutes: 25,
|
||||
difficulty: 'MEDIA',
|
||||
kcal: 470,
|
||||
proteinG: 38,
|
||||
fatG: 28,
|
||||
netCarbG: 8,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Petto di pollo', quantity: 150, unit: 'g' },
|
||||
{ name: 'Cavolfiore', quantity: 200, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1.5, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Salmone su crema di broccoli',
|
||||
category: 'CENA',
|
||||
description: 'Filetto di salmone scottato su vellutata di broccoli.',
|
||||
prepMinutes: 25,
|
||||
difficulty: 'MEDIA',
|
||||
kcal: 530,
|
||||
proteinG: 38,
|
||||
fatG: 36,
|
||||
netCarbG: 8,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Filetto di salmone', quantity: 150, unit: 'g' },
|
||||
{ name: 'Broccoli', quantity: 200, unit: 'g' },
|
||||
{ name: 'Burro', quantity: 10, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Polpettone di tacchino e ricotta',
|
||||
category: 'CENA',
|
||||
description: 'Polpettone con tacchino macinato, ricotta e spinaci.',
|
||||
prepMinutes: 35,
|
||||
difficulty: 'MEDIA',
|
||||
kcal: 480,
|
||||
proteinG: 42,
|
||||
fatG: 30,
|
||||
netCarbG: 4,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Petto di tacchino', quantity: 150, unit: 'g' },
|
||||
{ name: 'Ricotta vaccina', quantity: 60, unit: 'g' },
|
||||
{ name: 'Spinaci surgelati', quantity: 80, unit: 'g' },
|
||||
{ name: 'Uova', quantity: 1, unit: 'pz' },
|
||||
{ name: 'Parmigiano Reggiano', quantity: 20, unit: 'g' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Funghi ripieni di salsiccia (alternativa)',
|
||||
category: 'CENA',
|
||||
description: 'Funghi champignon farciti con tacchino e parmigiano.',
|
||||
prepMinutes: 25,
|
||||
difficulty: 'MEDIA',
|
||||
kcal: 420,
|
||||
proteinG: 32,
|
||||
fatG: 28,
|
||||
netCarbG: 4,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Funghi champignon', quantity: 200, unit: 'g' },
|
||||
{ name: 'Petto di tacchino', quantity: 100, unit: 'g' },
|
||||
{ name: 'Parmigiano Reggiano', quantity: 25, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Insalata di quinoa con pollo e verdure',
|
||||
category: 'CENA',
|
||||
description: 'Quinoa cotta con pollo, peperoni e zucchine grigliate.',
|
||||
prepMinutes: 25,
|
||||
difficulty: 'FACILE',
|
||||
kcal: 510,
|
||||
proteinG: 38,
|
||||
fatG: 22,
|
||||
netCarbG: 26,
|
||||
phases: [3],
|
||||
ingredients: [
|
||||
{ name: 'Quinoa cotta', quantity: 100, unit: 'g' },
|
||||
{ name: 'Petto di pollo', quantity: 130, unit: 'g' },
|
||||
{ name: 'Peperoni', quantity: 100, unit: 'g' },
|
||||
{ name: 'Zucchine', quantity: 100, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Branzino in crosta di erbe',
|
||||
category: 'CENA',
|
||||
description: 'Branzino al forno con crosta di basilico, prezzemolo e mandorle.',
|
||||
prepMinutes: 30,
|
||||
difficulty: 'MEDIA',
|
||||
kcal: 460,
|
||||
proteinG: 42,
|
||||
fatG: 28,
|
||||
netCarbG: 5,
|
||||
phases: [1, 2, 3],
|
||||
ingredients: [
|
||||
{ name: 'Branzino', quantity: 1, unit: 'pz' },
|
||||
{ name: 'Basilico fresco', quantity: 15, unit: 'g' },
|
||||
{ name: 'Mandorle', quantity: 20, unit: 'g' },
|
||||
{ name: 'Olio extravergine di oliva', quantity: 1.5, unit: 'cucchiaio' },
|
||||
],
|
||||
},
|
||||
];
|
||||
+19
-16
@@ -6,25 +6,28 @@ import { SEED_RECIPES } from './seed-recipes.js';
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main(): Promise<void> {
|
||||
// 1. Ingredienti — upsert sul nome (unique).
|
||||
// 1. Ingredienti — upsert sul nome (unique). Aggiorniamo phase2Week e gli
|
||||
// altri campi anche per quelli già presenti, così il seed resta autoritativo.
|
||||
let ingredientsInserted = 0;
|
||||
for (const i of SEED_INGREDIENTS) {
|
||||
const data = {
|
||||
category: i.category,
|
||||
defaultUnit: i.defaultUnit,
|
||||
kcalPer100g: i.kcalPer100g,
|
||||
proteinPer100g: i.proteinPer100g,
|
||||
fatPer100g: i.fatPer100g,
|
||||
netCarbPer100g: i.netCarbPer100g,
|
||||
exclusionGroups: i.exclusionGroups,
|
||||
priceAvgEur: i.priceAvgEur ?? null,
|
||||
phase2Week: i.phase2Week ?? null,
|
||||
};
|
||||
const existing = await prisma.ingredient.findUnique({ where: { name: i.name } });
|
||||
if (existing) continue;
|
||||
await prisma.ingredient.create({
|
||||
data: {
|
||||
name: i.name,
|
||||
category: i.category,
|
||||
defaultUnit: i.defaultUnit,
|
||||
kcalPer100g: i.kcalPer100g,
|
||||
proteinPer100g: i.proteinPer100g,
|
||||
fatPer100g: i.fatPer100g,
|
||||
netCarbPer100g: i.netCarbPer100g,
|
||||
exclusionGroups: i.exclusionGroups,
|
||||
priceAvgEur: i.priceAvgEur ?? null,
|
||||
},
|
||||
});
|
||||
ingredientsInserted++;
|
||||
if (existing) {
|
||||
await prisma.ingredient.update({ where: { id: existing.id }, data });
|
||||
} else {
|
||||
await prisma.ingredient.create({ data: { ...data, name: i.name } });
|
||||
ingredientsInserted++;
|
||||
}
|
||||
}
|
||||
|
||||
const allIngredients = await prisma.ingredient.findMany({ select: { id: true, name: true } });
|
||||
|
||||
Reference in new issue
Block a user