Create new services: inventory, recipes, suppliers
This commit is contained in:
@@ -12,9 +12,8 @@ from decimal import Decimal
|
||||
|
||||
class SalesDataBase(BaseModel):
|
||||
"""Base sales data schema"""
|
||||
product_name: str = Field(..., min_length=1, max_length=255, description="Product name")
|
||||
product_category: Optional[str] = Field(None, max_length=100, description="Product category")
|
||||
product_sku: Optional[str] = Field(None, max_length=100, description="Product SKU")
|
||||
# Product reference - REQUIRED reference to inventory service
|
||||
inventory_product_id: UUID = Field(..., description="Reference to inventory service product")
|
||||
|
||||
quantity_sold: int = Field(..., gt=0, description="Quantity sold")
|
||||
unit_price: Optional[Decimal] = Field(None, ge=0, description="Unit price")
|
||||
@@ -119,61 +118,8 @@ class SalesDataQuery(BaseModel):
|
||||
return v.lower()
|
||||
|
||||
|
||||
# Product schemas
|
||||
class ProductBase(BaseModel):
|
||||
"""Base product schema"""
|
||||
name: str = Field(..., min_length=1, max_length=255, description="Product name")
|
||||
sku: Optional[str] = Field(None, max_length=100, description="Stock Keeping Unit")
|
||||
category: Optional[str] = Field(None, max_length=100, description="Product category")
|
||||
subcategory: Optional[str] = Field(None, max_length=100, description="Product subcategory")
|
||||
|
||||
description: Optional[str] = Field(None, description="Product description")
|
||||
unit_of_measure: str = Field("unit", description="Unit of measure")
|
||||
weight: Optional[float] = Field(None, gt=0, description="Weight in grams")
|
||||
volume: Optional[float] = Field(None, gt=0, description="Volume in ml")
|
||||
|
||||
base_price: Optional[Decimal] = Field(None, ge=0, description="Base selling price")
|
||||
cost_price: Optional[Decimal] = Field(None, ge=0, description="Cost price")
|
||||
|
||||
is_seasonal: bool = Field(False, description="Seasonal product flag")
|
||||
seasonal_start: Optional[datetime] = Field(None, description="Season start date")
|
||||
seasonal_end: Optional[datetime] = Field(None, description="Season end date")
|
||||
|
||||
|
||||
class ProductCreate(ProductBase):
|
||||
"""Schema for creating products"""
|
||||
tenant_id: Optional[UUID] = Field(None, description="Tenant ID (set automatically)")
|
||||
|
||||
|
||||
class ProductUpdate(BaseModel):
|
||||
"""Schema for updating products"""
|
||||
name: Optional[str] = Field(None, min_length=1, max_length=255)
|
||||
sku: Optional[str] = Field(None, max_length=100)
|
||||
category: Optional[str] = Field(None, max_length=100)
|
||||
subcategory: Optional[str] = Field(None, max_length=100)
|
||||
description: Optional[str] = None
|
||||
unit_of_measure: Optional[str] = None
|
||||
weight: Optional[float] = Field(None, gt=0)
|
||||
volume: Optional[float] = Field(None, gt=0)
|
||||
base_price: Optional[Decimal] = Field(None, ge=0)
|
||||
cost_price: Optional[Decimal] = Field(None, ge=0)
|
||||
is_active: Optional[bool] = None
|
||||
is_seasonal: Optional[bool] = None
|
||||
seasonal_start: Optional[datetime] = None
|
||||
seasonal_end: Optional[datetime] = None
|
||||
|
||||
|
||||
class ProductResponse(ProductBase):
|
||||
"""Schema for product responses"""
|
||||
id: UUID
|
||||
tenant_id: UUID
|
||||
is_active: bool = True
|
||||
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
# Product schemas removed - using inventory service as single source of truth
|
||||
# Product data is accessed via inventory service client
|
||||
|
||||
|
||||
# Analytics schemas
|
||||
|
||||
Reference in New Issue
Block a user