fooder-api/fooder/model/product.py
Piotr Domański 1a7f7ec86b
Some checks failed
Python lint and test / linttest (push) Has been cancelled
[product] return cached usage data in response
2024-08-03 23:52:30 +02:00

36 lines
579 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
usage_count_cached: int | 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]