fooder-api/fooder/model/entry.py

39 lines
616 B
Python
Raw Normal View History

2023-04-01 16:19:12 +02:00
from typing import Optional
2024-08-04 16:17:16 +02:00
from pydantic import BaseModel
2023-04-01 16:19:12 +02:00
from .product import Product
class Entry(BaseModel):
"""Entry."""
id: int
grams: float
product: Product
meal_id: 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
class Config:
2023-07-30 20:18:42 +02:00
from_attributes = True
2023-04-01 16:19:12 +02:00
class CreateEntryPayload(BaseModel):
"""CreateEntryPayload."""
grams: float
product_id: int
meal_id: int
class UpdateEntryPayload(BaseModel):
"""CreateEntryPayload."""
grams: Optional[float]
product_id: Optional[int]
meal_id: Optional[int]