- Nuevo schema `crm` con 7 tablas multi-tenant (TenantScopedMixin + soft delete) - Módulos FastAPI por dominio: models/dto/service/routes (patrón example) - Métricas del dashboard (KPIs + embudo por etapa) - Conversión de prospecto → cuenta/contacto/oportunidad (idempotente) - Movimiento de oportunidad entre etapas (Kanban) con estado/probabilidad derivados - 25 permisos registrados en PermissionRegistry - Migración Alembic con upgrade/downgrade completos - 24 tests de servicios (pytest) en verde Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
59 lines
1.3 KiB
Python
59 lines
1.3 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class PipelineCreate(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=120)
|
|
is_default: bool = False
|
|
|
|
|
|
class PipelineUpdate(BaseModel):
|
|
name: str | None = Field(None, min_length=1, max_length=120)
|
|
is_default: bool | None = None
|
|
|
|
|
|
class PipelineResponse(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
name: str
|
|
is_default: bool
|
|
tenant_id: int
|
|
company_id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class StageCreate(BaseModel):
|
|
pipeline_id: int
|
|
name: str = Field(..., min_length=1, max_length=120)
|
|
position: int = Field(0, ge=0)
|
|
probability: int = Field(0, ge=0, le=100)
|
|
is_won: bool = False
|
|
is_lost: bool = False
|
|
|
|
|
|
class StageUpdate(BaseModel):
|
|
name: str | None = Field(None, min_length=1, max_length=120)
|
|
position: int | None = Field(None, ge=0)
|
|
probability: int | None = Field(None, ge=0, le=100)
|
|
is_won: bool | None = None
|
|
is_lost: bool | None = None
|
|
|
|
|
|
class StageResponse(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
pipeline_id: int
|
|
name: str
|
|
position: int
|
|
probability: int
|
|
is_won: bool
|
|
is_lost: bool
|
|
tenant_id: int
|
|
company_id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|