Spaces:
Sleeping
Sleeping
Download src/schemas/admin.py from hashir-qt/keyvault-api: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/hashir-qt/keyvault-api/resolve/main/src/schemas/admin.py
- Command line
-
hf download hf://spaces/hashir-qt/keyvault-api/src/schemas/admin.py
-
curl -L -o admin.py https://huggingface.co/spaces/hashir-qt/keyvault-api/resolve/main/src/schemas/admin.py
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} | |