Skip to content

Commit 9c147c8

Browse files
authored
Create atleta.py
1 parent 7560ef7 commit 9c147c8

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

app/schemas/atleta.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from pydantic import BaseModel, constr, Field
2+
3+
class AtletaBase(BaseModel):
4+
nome: str = Field(..., example="João Silva")
5+
cpf: constr(min_length=11, max_length=20) = Field(..., example="12345678901")
6+
7+
class AtletaCreate(AtletaBase):
8+
categoria_id: int | None = Field(None, example=1)
9+
centro_id: int | None = Field(None, example=1)
10+
11+
class AtletaRead(AtletaBase):
12+
id: int
13+
categoria: str | None = None
14+
centro_treinamento: str | None = None
15+
16+
class Config:
17+
from_attributes = True
18+
orm_mode = True

0 commit comments

Comments
 (0)