2023-04-01 16:19:12 +02:00
|
|
|
from typing import List, Optional
|
2024-08-04 16:17:16 +02:00
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
2023-04-01 16:19:12 +02:00
|
|
|
from .entry import Entry
|
|
|
|
|
|
|
|
|
|
|
|
class Meal(BaseModel):
|
|
|
|
"""Meal."""
|
|
|
|
|
|
|
|
id: int
|
|
|
|
name: str
|
|
|
|
order: int
|
|
|
|
calories: float
|
|
|
|
protein: float
|
|
|
|
carb: float
|
|
|
|
fat: float
|
2023-07-30 20:18:42 +02:00
|
|
|
fiber: float
|
2023-04-01 16:19:12 +02:00
|
|
|
entries: List[Entry]
|
|
|
|
diary_id: int
|
|
|
|
|
|
|
|
class Config:
|
2023-07-30 20:18:42 +02:00
|
|
|
from_attributes = True
|
2023-04-01 16:19:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
class CreateMealPayload(BaseModel):
|
|
|
|
"""CreateMealPayload."""
|
|
|
|
|
|
|
|
name: Optional[str]
|
|
|
|
diary_id: int
|
2023-10-27 15:12:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SaveMealPayload(BaseModel):
|
|
|
|
"""SaveMealPayload."""
|
|
|
|
|
|
|
|
name: Optional[str]
|
|
|
|
|
|
|
|
|
|
|
|
class CreateMealFromPresetPayload(BaseModel):
|
|
|
|
"""CreateMealPayload."""
|
|
|
|
|
|
|
|
name: Optional[str]
|
|
|
|
diary_id: int
|
|
|
|
preset_id: int
|