Piotr Domański
a701b952e8
Some checks are pending
Python lint and test / linttest (push) Waiting to run
35 lines
544 B
Python
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]
|