55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
"""CRM 客户公海池记录 Pydantic Schemas"""
|
||
from typing import List, Optional
|
||
|
||
from pydantic import BaseModel, ConfigDict, Field
|
||
|
||
from app.schemas.crm.customer import CustomerColumnFilterMixin
|
||
|
||
|
||
class PoolCustomerListBody(CustomerColumnFilterMixin):
|
||
model_config = ConfigDict(populate_by_name=True)
|
||
|
||
page: int = Field(default=1, ge=1)
|
||
pageSize: int = Field(default=10, ge=1, le=500)
|
||
keyword: Optional[str] = Field(default=None)
|
||
ids: Optional[List[str]] = Field(default=None, description="导出指定ID列表")
|
||
columns: Optional[List[str]] = Field(default=None, description="导出列(前端 visibleColumns)")
|
||
|
||
def to_list_kwargs(self) -> dict:
|
||
"""列筛 + keyword;公海范围由 list_pool_customers 强制 status=pool。"""
|
||
keyword = (self.keyword or "").strip() or None
|
||
return {
|
||
"keyword": keyword,
|
||
**self.column_filter_kwargs(),
|
||
}
|
||
|
||
|
||
class PoolAssignBody(BaseModel):
|
||
model_config = ConfigDict(populate_by_name=True)
|
||
|
||
ids: List[str] = Field(..., min_length=1)
|
||
ownerUserId: str = Field(...)
|
||
ownerUserName: str = Field(default="")
|
||
|
||
|
||
class PoolClaimBody(BaseModel):
|
||
model_config = ConfigDict(populate_by_name=True)
|
||
|
||
ids: List[str] = Field(..., min_length=1)
|
||
|
||
|
||
class PoolRecordListBody(BaseModel):
|
||
model_config = ConfigDict(populate_by_name=True)
|
||
|
||
page: int = Field(default=1, ge=1)
|
||
pageSize: int = Field(default=10, ge=1, le=500)
|
||
customerId: Optional[str] = Field(default=None)
|
||
operationType: Optional[str] = Field(default=None)
|
||
keyword: Optional[str] = Field(default=None)
|
||
|
||
|
||
class PoolRecordDetailBody(BaseModel):
|
||
model_config = ConfigDict(populate_by_name=True)
|
||
|
||
id: str = Field(...)
|