Initial commit: NutriApp - Rust + Axum + Dioxus - CI/CD con Gitea Runner
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
use chrono::NaiveDate;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Tipos compartidos entre backend y frontend (Dioxus).
|
||||
/// Ambos crates dependen de `shared`.
|
||||
|
||||
// ─── Enums ────────────────────────────────────────────────────
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub enum TipoComida {
|
||||
Desayuno,
|
||||
Comida,
|
||||
Cena,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub enum UnidadMedida {
|
||||
Gramos,
|
||||
Mililitros,
|
||||
Unidad,
|
||||
Cucharada,
|
||||
Cucharadita,
|
||||
Taza,
|
||||
Pizca,
|
||||
AlGusto,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub enum CategoriaIngrediente {
|
||||
Verdura,
|
||||
Fruta,
|
||||
Proteina,
|
||||
Lacteo,
|
||||
Cereal,
|
||||
Legumbre,
|
||||
Bebida,
|
||||
Snack,
|
||||
Condimento,
|
||||
Otro,
|
||||
}
|
||||
|
||||
// ─── DTOs ─────────────────────────────────────────────────────
|
||||
|
||||
/// Receta con sus ingredientes
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct RecetaDto {
|
||||
pub id: Uuid,
|
||||
pub nombre: String,
|
||||
pub descripcion: Option<String>,
|
||||
pub porciones: i32,
|
||||
pub tiempo_preparacion_min: Option<i32>,
|
||||
pub instrucciones: Option<String>,
|
||||
pub imagen_url: Option<String>,
|
||||
pub ingredientes: Vec<IngredienteRecetaDto>,
|
||||
}
|
||||
|
||||
/// Cantidad de un ingrediente en una receta
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct IngredienteRecetaDto {
|
||||
pub ingrediente_id: Uuid,
|
||||
pub nombre: String,
|
||||
pub cantidad: f64,
|
||||
pub unidad: UnidadMedida,
|
||||
pub categoria: CategoriaIngrediente,
|
||||
}
|
||||
|
||||
/// Un platillo asignado a un slot del calendario
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SlotComidaDto {
|
||||
pub id: Uuid,
|
||||
pub fecha: NaiveDate,
|
||||
pub tipo: TipoComida,
|
||||
pub receta_id: Uuid,
|
||||
pub receta_nombre: String,
|
||||
pub porciones: i32,
|
||||
}
|
||||
|
||||
/// Solicitud de lista de compras
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ListaCompraRequest {
|
||||
pub familia_id: Uuid,
|
||||
pub desde: NaiveDate,
|
||||
pub hasta: NaiveDate,
|
||||
}
|
||||
|
||||
/// Item de la lista de compras
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ItemCompraDto {
|
||||
pub ingrediente_id: Uuid,
|
||||
pub nombre: String,
|
||||
pub cantidad_total: f64,
|
||||
pub unidad: UnidadMedida,
|
||||
pub categoria: CategoriaIngrediente,
|
||||
pub en_inventario: bool,
|
||||
}
|
||||
Reference in New Issue
Block a user