keyvault-api / src /schemas /admin.py
hashir-qt's picture
Upload folder using huggingface_hub
e656014 verified
Raw History Blame Contribute Delete
1.34 kB
"""Pydantic schemas for admin API responses."""
from datetime import datetime
from typing import Optional
from pydantic import BaseModel
from src.models.seller_profile import SellerStatus, SellerTier
class AdminStatsResponse(BaseModel):
"""Platform-wide KPI stats for the admin dashboard."""
total_users: int
total_sellers: int
total_orders: int
platform_gmv: float
class AdminOrderView(BaseModel):
"""A single order as seen by the admin (no decrypted keys)."""
id: str
product_title: str # title_at_purchase from first order item
buyer_username: str
created_at: datetime
total_price: float
status: str
class AdminUserView(BaseModel):
"""A platform user as seen by the admin."""
id: str
email: str
username: str
full_name: str
role: str
is_active: bool
created_at: datetime
model_config = {"from_attributes": True}
class AdminSellerView(BaseModel):
"""A seller profile enriched with the user's email, for admin review."""
id: str # seller_profile.id
user_id: str
store_name: Optional[str]
store_description: Optional[str]
email: str
tier: SellerTier
status: SellerStatus
total_sales: int
id_submitted: bool
created_at: datetime
model_config = {"from_attributes": True}