We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7560ef7 commit 9c147c8Copy full SHA for 9c147c8
1 file changed
app/schemas/atleta.py
@@ -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