- Replace black, isort, and flake8 with Ruff (all-in-one linter and formatter) - Add comprehensive pyproject.toml configuration - Simplify Makefile code quality targets - Configure exclusions for venv/.venv in pyproject.toml - Auto-fix 1,359 linting issues across codebase Benefits: - Much faster builds (Ruff is written in Rust) - Single tool replaces multiple tools - More comprehensive rule set (UP, B, C4, SIM, PIE, RET, Q) - All configuration centralized in pyproject.toml - Better import sorting and formatting consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
71 lines
1.9 KiB
Python
71 lines
1.9 KiB
Python
from datetime import datetime
|
|
from decimal import Decimal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class StatsResponse(BaseModel):
|
|
total_products: int
|
|
unique_brands: int
|
|
unique_categories: int
|
|
unique_marketplaces: int = 0
|
|
unique_vendors: int = 0
|
|
total_inventory_entries: int = 0
|
|
total_inventory_quantity: int = 0
|
|
|
|
|
|
class MarketplaceStatsResponse(BaseModel):
|
|
marketplace: str
|
|
total_products: int
|
|
unique_vendors: int
|
|
unique_brands: int
|
|
|
|
|
|
# ============================================================================
|
|
# Customer Statistics
|
|
# ============================================================================
|
|
|
|
|
|
class CustomerStatsResponse(BaseModel):
|
|
"""Schema for customer statistics."""
|
|
|
|
customer_id: int
|
|
total_orders: int
|
|
total_spent: Decimal
|
|
average_order_value: Decimal
|
|
last_order_date: datetime | None
|
|
first_order_date: datetime | None
|
|
lifetime_value: Decimal
|
|
|
|
|
|
# ============================================================================
|
|
# Order Statistics
|
|
# ============================================================================
|
|
|
|
|
|
class OrderStatsResponse(BaseModel):
|
|
"""Schema for order statistics."""
|
|
|
|
total_orders: int
|
|
pending_orders: int
|
|
processing_orders: int
|
|
shipped_orders: int
|
|
delivered_orders: int
|
|
cancelled_orders: int
|
|
total_revenue: Decimal
|
|
average_order_value: Decimal
|
|
|
|
|
|
# ============================================================================
|
|
# Vendor Statistics
|
|
# ============================================================================
|
|
|
|
|
|
class VendorStatsResponse(BaseModel):
|
|
"""Vendor statistics response schema."""
|
|
|
|
total: int = Field(..., description="Total number of vendors")
|
|
verified: int = Field(..., description="Number of verified vendors")
|
|
pending: int = Field(..., description="Number of pending verification vendors")
|
|
inactive: int = Field(..., description="Number of inactive vendors")
|