Skip to content

Commit 4680a16

Browse files
authored
Merge pull request #13 from souovan/python-flask
Adding an endpoint to filter one user by id
2 parents c6d6aae + 1d934c1 commit 4680a16

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

python-flask/src/app.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ def __init__(self, id_vendedor, nome_vendedor, login, senha):
285285
self.login = login
286286
self.senha = senha
287287

288-
@app.route('/test', methods=['GET'])
289-
def test():
290-
return {
291-
'test': 'test1'
292-
}, 200
288+
# @app.route('/test', methods=['GET'])
289+
# def test():
290+
# return {
291+
# 'test': 'test1'
292+
# }, 200
293293

294294
@app.route('/usuarios', methods=['GET'])
295295
def all_users():
@@ -304,6 +304,16 @@ def all_users():
304304
output.append(current_user)
305305
return jsonify(output), 200
306306

307+
@app.route('/usuario/<id>', methods=['GET'])
308+
def show_user(id):
309+
usuario = user.query.get(id)
310+
return jsonify([{
311+
'id_usuario': usuario.id_usuario,
312+
'fk_id_categoria_usuario': usuario.fk_id_categoria_usuario,
313+
'login': usuario.login,
314+
'senha': usuario.senha
315+
}]), 200
316+
307317
@app.route('/agendamentos', methods=['GET'])
308318
def all_scheduling():
309319
all_scheduling = scheduling.query.all()

0 commit comments

Comments
 (0)