fooder-api/fooder/model/product.py
2023-07-30 20:18:42 +02:00

33 lines
519 B
Python

from pydantic import BaseModel
from typing import List
class Product(BaseModel):
"""Product."""
id: int
name: str
calories: float
protein: float
carb: float
fat: float
fiber: float
class Config:
from_attributes = True
class CreateProductPayload(BaseModel):
"""ProductCreatePayload."""
name: str
protein: float
carb: float
fat: float
fiber: float
class ListProductPayload(BaseModel):
"""ProductListPayload."""
products: List[Product]