15 lines
337 B
Python
15 lines
337 B
Python
|
|
from pydantic import BaseModel
|
||
|
|
from typing import Optional
|
||
|
|
from datetime import datetime
|
||
|
|
|
||
|
|
class Product(BaseModel):
|
||
|
|
id: int
|
||
|
|
name: str
|
||
|
|
description: Optional[str] = None
|
||
|
|
price: float
|
||
|
|
stock: int = 0
|
||
|
|
is_available: bool = True
|
||
|
|
created_at: datetime = datetime.now()
|
||
|
|
|
||
|
|
class Config:
|
||
|
|
from_attributes = True
|