Adicionar endpoint: GET /trainer/{trainerId}

This commit is contained in:
Augusto Gunsch 2021-10-17 19:15:56 -03:00
parent bbfddcae56
commit 0e3cb2eed6
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
2 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,10 @@ from sqlite3 import ProgrammingError, IntegrityError
from api.app import app, db
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'])
def route_get_trainers():
return trainer.get_trainers()

View File

@ -11,6 +11,9 @@ def error(code, type, message, http_code=400):
"message": message
}, http_code)
def get_trainer(id):
return trainer_schema.dump(Trainer.query.get(id))
def get_trainers():
args = request.args