fooder-api/fooder/model/product.py
Piotr Domański a701b952e8
Some checks are pending
Python lint and test / linttest (push) Waiting to run
[product] return code in response
2024-08-03 22:30:39 +02:00

35 lines
544 B
Python

from typing import List
from pydantic import BaseModel
class Product(BaseModel):
"""Product."""
id: int
name: str
calories: float
protein: float
carb: float
fat: float
fiber: float
barcode: str | None
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]