Skip to content

Nutrición

Endpoints para gestionar alimentos, planes nutricionales, registros de comidas e ingesta de agua.

Los siguientes modelos de Prisma pertenecen al schema nutrition:

model Food {
id String @id @default(cuid())
name String
brand String?
barcode String?
calories Float
protein Float
carbohydrates Float @map("carbs")
fat Float
fiber Float?
sugar Float?
sodium Float?
servingSize Float? @map("serving_size")
servingUnit String? @map("serving_unit")
category FoodCategory
allergens String[]
isVerified Boolean @default(false) @map("is_verified")
source String?
foodEntries FoodEntry[]
planFoods PlanFood[]
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@index([name])
@@index([barcode])
@@index([category])
@@map("foods")
@@schema("nutrition")
}
model NutritionPlan {
id String @id @default(cuid())
name String
description String?
type PlanType
difficulty PlanDifficulty @default(BEGINNER)
duration Int?
calorieTarget Int? @map("calorie_target")
proteinPercentage Float? @map("protein_percentage")
carbPercentage Float? @map("carb_percentage")
fatPercentage Float? @map("fat_percentage")
createdById String @map("created_by_id")
isPublic Boolean @default(false) @map("is_public")
isActive Boolean @default(true) @map("is_active")
tags String[]
createdBy UserProfile @relation("CreatedNutritionPlans", fields: [createdById], references: [id], onDelete: Cascade)
assignments PlanAssignment[]
planFoods PlanFood[]
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("nutrition_plans")
@@schema("nutrition")
}
model MealLog {
id String @id @default(cuid())
userProfileId String @map("user_profile_id")
logDate DateTime @map("log_date")
mealType MealType @map("meal_type")
notes String?
moodBefore Int? @map("mood_before")
moodAfter Int? @map("mood_after")
hungerLevel Int? @map("hunger_level")
photoUrl String? @map("photo_url")
userProfile UserProfile @relation(fields: [userProfileId], references: [id], onDelete: Cascade)
foodEntries FoodEntry[]
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@index([userProfileId, logDate])
@@map("meal_logs")
@@schema("nutrition")
}
model WaterIntake {
id String @id @default(cuid())
userProfileId String @map("user_profile_id")
logDate DateTime @map("log_date")
amount Float
userProfile UserProfile @relation(fields: [userProfileId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now()) @map("created_at")
@@index([userProfileId, logDate])
@@map("water_intake")
@@schema("nutrition")
}

El módulo de Nutrición proporciona un conjunto completo de endpoints para:

  • Alimentos: Gestionar la base de datos de alimentos
  • Planes Nutricionales: Crear y gestionar planes nutricionales
  • Registros de Comidas: Seguimiento de comidas y consumo de alimentos
  • Ingesta de Agua: Seguimiento del consumo diario de agua
  • Objetivos Nutricionales: Establecer y gestionar objetivos nutricionales

Explora las siguientes secciones para documentación detallada de la API: