
This API provides endpoints for: - Product and inventory management - Customer management - Order processing - Payment processing with Stripe integration - User authentication generated with BackendIM... (backend.im)
39 lines
731 B
Python
39 lines
731 B
Python
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class ProductBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
sku: str
|
|
price: float
|
|
image_url: Optional[str] = None
|
|
is_active: bool = True
|
|
|
|
|
|
class ProductCreate(ProductBase):
|
|
pass
|
|
|
|
|
|
class ProductUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
sku: Optional[str] = None
|
|
price: Optional[float] = None
|
|
image_url: Optional[str] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class ProductInDBBase(ProductBase):
|
|
id: int
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class Product(ProductInDBBase):
|
|
pass
|
|
|
|
|
|
class ProductWithInventory(Product):
|
|
inventory_quantity: int = 0 |