File tree Expand file tree Collapse file tree 4 files changed +7
-9
lines changed Expand file tree Collapse file tree 4 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 1111from pydantic import BaseModel , ValidationError , FilePath
1212
1313from app import error_messages
14- from pprint import pprint
1514
1615# access control
1716def resource (resource_name ):
@@ -87,7 +86,6 @@ def wrapped(*args, **kwargs):
8786 try :
8887 validator .parse_raw (data )
8988 except ValidationError as e :
90- pprint (e .errors ())
9189 for error in e .errors ():
9290 msg = error_messages .get (error ['type' ])
9391 ctx = error .get ('ctx' )
Original file line number Diff line number Diff line change 77 jwt_refresh_token_required ,
88 get_jwt_identity ,
99)
10+ from . import field_validator
1011from sqlalchemy import or_
1112from app import Usuario , fieldsFormatter , Perfil
1213from app import AuthLoginSchema
1718
1819
1920@app .route ("/auth" , methods = ["POST" ])
20- @validate ( body = AuthLoginSchema )
21+ @field_validator ( AuthLoginSchema )
2122def login ():
2223 data = request .get_json ()
2324
Original file line number Diff line number Diff line change 22from flask import request , jsonify
33from flask_jwt_extended import jwt_required , get_jwt_identity
44from sqlalchemy import exc , or_
5- from . import resource , paginate
5+ from . import resource , paginate , field_validator
66from app import Perfil , Usuario
77from app import fieldsFormatter
88
@@ -86,7 +86,7 @@ def perfilView(perfil_id):
8686@app .route ("/perfil/add" , methods = ["POST" ])
8787@jwt_required
8888@resource ("perfil-add" )
89- @validate ( body = PerfilAddSchema )
89+ @field_validator ( PerfilAddSchema )
9090def perfilAdd ():
9191
9292 data = request .get_json ()
@@ -134,7 +134,7 @@ def perfilAdd():
134134@app .route ("/perfil/edit/<perfil_id>" , methods = ["PUT" ])
135135@jwt_required
136136@resource ("perfil-edit" )
137- @validate ( body = PerfilAddSchema )
137+ @field_validator ( PerfilAddSchema )
138138def perfilEdit (perfil_id ):
139139 data = request .get_json ()
140140
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ def usuarioView(usuario_id):
8080@app .route ("/usuario/add" , methods = ["POST" ])
8181@jwt_required
8282@resource ("usuario-add" )
83- @validate ( body = UsuarioAddSchema )
83+ @field_validator ( UsuarioAddSchema )
8484def usuarioAdd ():
8585 data = request .get_json ()
8686
@@ -129,7 +129,7 @@ def usuarioAdd():
129129@app .route ("/usuario/edit/<usuario_id>" , methods = ["PUT" ])
130130@jwt_required
131131@resource ("usuario-edit" )
132- @validate ( body = UsuarioEditSchema )
132+ @field_validator ( UsuarioEditSchema )
133133def usuarioEdit (usuario_id ):
134134 data = request .get_json ()
135135
@@ -232,7 +232,6 @@ def usuarioDelete(usuario_id):
232232# --------------------------------------------------------------------------------------------------#
233233
234234@app .route ("/usuario/cadastro" , methods = ["POST" ])
235- #@validate(body=CadastroAddSchema)
236235@field_validator (CadastroAddSchema )
237236def cadastroAdd ():
238237 data = request .get_json ()
You can’t perform that action at this time.
0 commit comments