from pydantic import BaseModel from typing import Optional, Dict, List, Any from datetime import datetime # Request schema for mapping class ImportMapping(BaseModel): start_row: int = 1 # Mapping from database field (key) to Excel column index/name (value) # e.g. {"mobile": "A", "name": "B", "english_name": "C"} or {"mobile": 0, "name": 1} mapping: Dict[str, Any] class ImportLogBase(BaseModel): filename: str total_count: int success_count: int fail_count: int result_data: Optional[List[Dict[str, Any]]] = None class ImportLogCreate(ImportLogBase): created_by: int class ImportLog(ImportLogBase): id: int created_at: datetime created_by: Optional[int] class Config: from_attributes = True class ImportPreview(BaseModel): headers: List[str] preview_data: List[List[Any]] # First few rows