Files
shanxia2.0/backend/app/schemas/crm/customer_pool.py
T

55 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""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(...)