from datetime import datetime from typing import Optional from pydantic import BaseModel, Field class BaseIndex(BaseModel): code: str = Field(..., description="行业代码", example="001") name: str = Field(..., description="行业名称", example="农业") search_num: float = Field(0, description="行业基准搜索指数", example=1.25) remark: str = Field("备注", description="备注", example="基准搜索指数说明") class IndexCreate(BaseIndex): pass class IndexUpdate(BaseIndex): id: int class IndexResponse(BaseIndex): id: int created_at: Optional[datetime] updated_at: Optional[datetime]