Some checks are pending
Python lint and test / linttest (push) Waiting to run
38 lines
637 B
Python
38 lines
637 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
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
|
|
fiber: float
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class CreateEntryPayload(BaseModel):
|
|
"""CreateEntryPayload."""
|
|
|
|
grams: float
|
|
product_id: int
|
|
meal_id: int
|
|
|
|
|
|
class UpdateEntryPayload(BaseModel):
|
|
"""CreateEntryPayload."""
|
|
|
|
grams: Optional[float] = None
|
|
product_id: Optional[int] = None
|
|
meal_id: Optional[int] = None
|