Coverage for backend \ app \ Clientes \ schemas \ clienteSchemas.py: 100.00%

26 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-29 16:13 -0500

1from pydantic import BaseModel, Field, EmailStr 

2from typing import Optional 

3 

4 

5class ClienteBaseSchema(BaseModel): 

6 nombreCliente: str = Field(..., min_length=3, max_length=50, example="Jorge Pérez") 

7 cedulaCliente: str = Field(..., min_length=10, max_length=10, example="1723456789") 

8 telefonoCliente: str = Field(..., min_length=10, max_length=10, example="0987654321") 

9 direccionCliente: str = Field(..., max_length=100, example="Av. Amazonas N12-34, Quito, Ecuador") 

10 emailCliente: EmailStr = Field(..., example="jorge.perez@example.com") 

11 

12 

13class ClienteCrearSchema(ClienteBaseSchema): 

14 pass 

15 

16 

17class ClienteActualizarSchema(BaseModel): 

18 nombreCliente: Optional[str] = Field(None, min_length=3, max_length=50, example="Jorge Pérez") 

19 telefonoCliente: Optional[str] = Field(None, min_length=10, max_length=10, example="0987654321") 

20 direccionCliente: Optional[str] = Field(None, max_length=100, example="Av. Amazonas N12-34, Quito, Ecuador") 

21 emailCliente: Optional[EmailStr] = Field(None, example="jorge.perez@example.com") 

22 activoCliente: Optional[bool] = None 

23 

24 

25class ClienteRespuestaSchema(BaseModel): 

26 idCliente: int 

27 nombreCliente: str 

28 cedulaCliente: str 

29 telefonoCliente: str 

30 direccionCliente: str 

31 emailCliente: EmailStr 

32 activoCliente: bool 

33 

34 class Config: 

35 from_attributes = True