2026-09-22 16:13:45 +08:00
|
|
|
from pydantic import BaseModel, ConfigDict
|
2026-03-17 22:20:56 +08:00
|
|
|
from typing import Optional
|
2026-04-19 23:41:35 +08:00
|
|
|
from decimal import Decimal
|
2026-03-08 22:58:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class InventoryResponse(BaseModel):
|
|
|
|
|
id: int
|
|
|
|
|
product_id: int
|
|
|
|
|
product_name: str
|
|
|
|
|
product_sku: str
|
|
|
|
|
warehouse_id: int
|
|
|
|
|
warehouse_name: str
|
2026-04-19 23:41:35 +08:00
|
|
|
quantity: Decimal
|
|
|
|
|
locked_quantity: Decimal
|
|
|
|
|
available_quantity: Decimal
|
2026-03-08 22:58:25 +08:00
|
|
|
|
2026-09-22 16:13:45 +08:00
|
|
|
model_config = ConfigDict(from_attributes=True)
|
2026-03-17 22:20:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class InventoryCreate(BaseModel):
|
|
|
|
|
product_id: int
|
|
|
|
|
warehouse_id: int
|
2026-04-19 23:41:35 +08:00
|
|
|
quantity: Decimal = Decimal("0")
|
|
|
|
|
locked_quantity: Decimal = Decimal("0")
|
2026-03-17 22:20:56 +08:00
|
|
|
batch_number: Optional[str] = None
|
|
|
|
|
location: Optional[str] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InventoryUpdate(BaseModel):
|
2026-04-19 23:41:35 +08:00
|
|
|
quantity: Optional[Decimal] = None
|
|
|
|
|
locked_quantity: Optional[Decimal] = None
|
2026-03-17 22:20:56 +08:00
|
|
|
batch_number: Optional[str] = None
|
|
|
|
|
location: Optional[str] = None
|