Piotr Domański
1a7f7ec86b
Some checks failed
Python lint and test / linttest (push) Has been cancelled
36 lines
579 B
Python
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]
|