Exemple #1
0
    def update_user(user_id, **kwargs):
        user = UserModel.get_user_by_id(user_id)

        for key in user:
            if key in kwargs:
                user[key] = kwargs[key]

        UserModel.delete_user(user_id)
        UserModel.register_user(user)

        return UserModel.get_user_by_id(user_id)
def delete_user(current_user, search_id):
    user = UserModel.get_user_by_id(current_user)
    if user['role'] != "admin":
        return jsonify(
            {"message": "You are not authorised to view this function"}), 401
    user = UserModel.delete_user(search_id)
    if user:
        return jsonify({'Message': user}), 200
    return jsonify({'Message': user}), 404
Exemple #3
0
 def delete_user(user_id: int) -> bool:
     return UserModel.delete_user(user_id)