Fix new services implementation 3

This commit is contained in:
Urtzi Alfaro
2025-08-14 16:47:34 +02:00
parent 0951547e92
commit 03737430ee
51 changed files with 657 additions and 982 deletions

View File

@@ -53,9 +53,10 @@ class SalesDataCreate(SalesDataBase):
class SalesDataUpdate(BaseModel):
"""Schema for updating sales data"""
product_name: Optional[str] = Field(None, min_length=1, max_length=255)
product_category: Optional[str] = Field(None, max_length=100)
product_sku: Optional[str] = Field(None, max_length=100)
# Note: product_name and product_category fields removed - use inventory service for product management
# product_name: Optional[str] = Field(None, min_length=1, max_length=255) # DEPRECATED
# product_category: Optional[str] = Field(None, max_length=100) # DEPRECATED
# product_sku: Optional[str] = Field(None, max_length=100) # DEPRECATED - use inventory service
quantity_sold: Optional[int] = Field(None, gt=0)
unit_price: Optional[Decimal] = Field(None, ge=0)
@@ -98,8 +99,10 @@ class SalesDataQuery(BaseModel):
"""Schema for sales data queries"""
start_date: Optional[datetime] = None
end_date: Optional[datetime] = None
product_name: Optional[str] = None
product_category: Optional[str] = None
# Note: product_name and product_category filtering now requires inventory service integration
# product_name: Optional[str] = None # DEPRECATED - use inventory_product_id or join with inventory service
# product_category: Optional[str] = None # DEPRECATED - use inventory service categories
inventory_product_id: Optional[UUID] = None # Filter by specific inventory product ID
location_id: Optional[str] = None
sales_channel: Optional[str] = None
source: Optional[str] = None
@@ -136,7 +139,8 @@ class SalesAnalytics(BaseModel):
class ProductSalesAnalytics(BaseModel):
"""Product-specific sales analytics"""
product_name: str
inventory_product_id: UUID # Reference to inventory service product
# Note: product_name can be fetched from inventory service using inventory_product_id
total_revenue: Decimal
total_quantity: int
total_transactions: int