feat: add admin customer management
- Add admin customers API endpoints - Add AdminCustomerService for customer operations - Enhance customers.html template with management features - Add customers.js Alpine component - Add customer list schemas 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -248,8 +248,54 @@ class CustomerOrdersResponse(BaseModel):
|
||||
class CustomerStatisticsResponse(BaseModel):
|
||||
"""Response for customer statistics."""
|
||||
|
||||
total: int = 0
|
||||
active: int = 0
|
||||
inactive: int = 0
|
||||
with_orders: int = 0
|
||||
total_spent: float = 0.0
|
||||
total_orders: int = 0
|
||||
avg_order_value: float = 0.0
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Admin Customer Management Response Schemas
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class AdminCustomerItem(BaseModel):
|
||||
"""Admin customer list item with vendor info."""
|
||||
|
||||
id: int
|
||||
vendor_id: int
|
||||
email: str
|
||||
first_name: str | None = None
|
||||
last_name: str | None = None
|
||||
phone: str | None = None
|
||||
customer_number: str
|
||||
marketing_consent: bool = False
|
||||
preferred_language: str | None = None
|
||||
last_order_date: datetime | None = None
|
||||
total_orders: int = 0
|
||||
total_spent: float = 0.0
|
||||
average_order_value: float = 0.0
|
||||
last_order_date: datetime | None = None
|
||||
message: str | None = None
|
||||
is_active: bool = True
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
vendor_name: str | None = None
|
||||
vendor_code: str | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class CustomerListResponse(BaseModel):
|
||||
"""Admin paginated customer list with skip/limit."""
|
||||
|
||||
customers: list[AdminCustomerItem] = []
|
||||
total: int = 0
|
||||
skip: int = 0
|
||||
limit: int = 20
|
||||
|
||||
|
||||
class CustomerDetailResponse(AdminCustomerItem):
|
||||
"""Detailed customer response for admin."""
|
||||
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user