diff --git a/api/routes/routes.py b/api/routes/routes.py index b322a4e..be7686c 100644 --- a/api/routes/routes.py +++ b/api/routes/routes.py @@ -3,6 +3,10 @@ from sqlite3 import ProgrammingError, IntegrityError from api.app import app, db from api.views import trainer +@app.route('/trainer/', 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() diff --git a/api/views/trainer.py b/api/views/trainer.py index fa56982..0829bf3 100644 --- a/api/views/trainer.py +++ b/api/views/trainer.py @@ -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