Commit 3b871740 authored by Beno Sons's avatar Beno Sons

profile

parent 4a381be1
......@@ -35,7 +35,13 @@ def get_users():
return error_response(f"Database connection failed: {connection_error}", code=500)
users = User.query.all()
users_data = [{"id": user.id, "username": user.username, "email": user.email, "role_id": [role.name for role in user.roles]} for user in users]
users_data = [Master.row2dict(user) for user in users]
for usr in users_data:
if 'password' in usr:
del usr['password']
if 'current_refresh_token' in usr:
del usr['current_refresh_token']
return success_response(data=users_data)
@user_bp.route('/<int:user_id>', methods=['GET'])
......@@ -46,7 +52,7 @@ def get_user(user_id):
return error_response(f"Database connection failed: {connection_error}", code=500)
user = User.query.get_or_404(user_id)
user_data = {"id": user.id, "username": user.username, "email": user.email, "role_id": [role.name for role in user.roles]}
user_data = {"id": user.id, "username": user.username, "email": user.email}
return success_response(data=user_data)
@user_bp.route('/create', methods=['POST'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment