Alinea el dominio al spec de catálogos: - accounts (Clientes/Prospectos): tipo registro/persona, CURP, clasificación comercial, bloque fiscal (régimen, CFDI, pago, crédito), auditoría, notas internas - suppliers (Proveedores): clasificación múltiple, cobertura, países/puertos/ aeropuertos/aduanas (JSON), fiscal - addresses y documents: tablas compartidas con FK a cliente o proveedor - contacts enriquecidos (extensión, whatsapp, área, flags "recibe…", supplier_id) - migración a7b8c9d0e1f2 (ALTER + CREATE) con downgrade completo - permisos supplier/address/document; seed de datos actualizado - 39 tests pytest en verde Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class AddressBase(BaseModel):
|
|
account_id: int | None = None
|
|
supplier_id: int | None = None
|
|
address_type: str = Field("fiscal", max_length=20)
|
|
street: str | None = Field(None, max_length=255)
|
|
ext_number: str | None = Field(None, max_length=30)
|
|
int_number: str | None = Field(None, max_length=30)
|
|
neighborhood: str | None = Field(None, max_length=120)
|
|
postal_code: str | None = Field(None, max_length=10)
|
|
city: str | None = Field(None, max_length=120)
|
|
state: str | None = Field(None, max_length=120)
|
|
country: str | None = Field("MX", max_length=2)
|
|
reference_notes: str | None = None
|
|
is_primary: bool = False
|
|
|
|
|
|
class AddressCreate(AddressBase):
|
|
pass
|
|
|
|
|
|
class AddressUpdate(BaseModel):
|
|
address_type: str | None = Field(None, max_length=20)
|
|
street: str | None = Field(None, max_length=255)
|
|
ext_number: str | None = Field(None, max_length=30)
|
|
int_number: str | None = Field(None, max_length=30)
|
|
neighborhood: str | None = Field(None, max_length=120)
|
|
postal_code: str | None = Field(None, max_length=10)
|
|
city: str | None = Field(None, max_length=120)
|
|
state: str | None = Field(None, max_length=120)
|
|
country: str | None = Field(None, max_length=2)
|
|
reference_notes: str | None = None
|
|
is_primary: bool | None = None
|
|
|
|
|
|
class AddressResponse(AddressBase):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
tenant_id: int
|
|
company_id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|