Adicionar endpoint: GET /trainer/{trainerId}
This commit is contained in:
parent
bbfddcae56
commit
0e3cb2eed6
|
@ -3,6 +3,10 @@ from sqlite3 import ProgrammingError, IntegrityError
|
||||||
from api.app import app, db
|
from api.app import app, db
|
||||||
from api.views import trainer
|
from api.views import trainer
|
||||||
|
|
||||||
|
@app.route('/trainer/<int:trainerId>', methods=['GET'])
|
||||||
|
def route_get_trainer(trainerId):
|
||||||
|
return trainer.get_trainer(trainerId)
|
||||||
|
|
||||||
@app.route('/trainer', methods=['GET'])
|
@app.route('/trainer', methods=['GET'])
|
||||||
def route_get_trainers():
|
def route_get_trainers():
|
||||||
return trainer.get_trainers()
|
return trainer.get_trainers()
|
||||||
|
|
|
@ -11,6 +11,9 @@ def error(code, type, message, http_code=400):
|
||||||
"message": message
|
"message": message
|
||||||
}, http_code)
|
}, http_code)
|
||||||
|
|
||||||
|
def get_trainer(id):
|
||||||
|
return trainer_schema.dump(Trainer.query.get(id))
|
||||||
|
|
||||||
def get_trainers():
|
def get_trainers():
|
||||||
args = request.args
|
args = request.args
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue