fooder-api/fooder/model/entry.py

38 lines
615 B
Python
Raw Normal View History

2023-04-01 16:19:12 +02:00
from pydantic import BaseModel
from typing import Optional
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]