Skip to main content

Module models

Module models 

Source

Structs§

CooklangIngredient
DailySummary
DailyTarget
ExportData
ExportMealEntry
ExportRecipe
ExportRecipeIngredient
ExportTarget
ExportWeightEntry
Food
ImportSummary
LegacyExportTarget
Legacy export target without day_of_week (for backward compatibility with old exports).
MealEntry
MealGroup
NewFood
NewMealEntry
NewWeightEntry
RecentFood
Recipe
RecipeDetail
RecipeIngredient
SyncPayload
SyncPushRequest
SyncTombstone
UpdateMealEntry
WeightEntry

Constants§

MEAL_TYPES
VALID_TOMBSTONE_TABLES
Valid table names for sync tombstones.

Functions§

convert_to_grams
Convert a quantity with a unit to grams. Volume-based conversions assume water density (1 ml = 1 g). Returns (grams, is_approximate) where is_approximate is true for volume conversions.
validate_export_meal_entry
Validate an exported/synced meal entry: meal_type, serving_g, and date format.
validate_export_recipe
Validate an exported/synced recipe: portions must be positive.
validate_export_recipe_ingredient
Validate an exported/synced recipe ingredient: quantity must be positive.
validate_export_target
Validate an exported/synced target: day 0-6, calories > 0, macro split if present.
validate_export_weight_entry
Validate an exported/synced weight entry: weight > 0, valid date.
validate_food_data
Validate imported food data: name must not be empty, calories must not be negative.
validate_macro_split
validate_meal_entry_data
Validate an imported meal entry: meal_type and serving_g.
validate_meal_type
validate_tombstone
Validate a sync tombstone: table_name must be in the allowed list, deleted_at must be valid RFC 3339, and future timestamps are capped to now.