fooder-api/fooder/model/product.py

34 lines
519 B
Python
Raw Normal View History

2023-04-01 16:19:12 +02:00
from pydantic import BaseModel
from typing import List
class Product(BaseModel):
"""Product."""
id: int
name: str
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 CreateProductPayload(BaseModel):
"""ProductCreatePayload."""
name: str
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 ListProductPayload(BaseModel):
"""ProductListPayload."""
products: List[Product]