From c708e6bfffd51a13124afb6f82d19c9646ea821d Mon Sep 17 00:00:00 2001 From: stefanogoldoni Date: Wed, 28 Apr 2021 00:40:46 +0200 Subject: [PATCH] durante i test abbiamo notato che gli utenti non venivano eliminati ed avevamo una eccezione. Abbiamo modificato la cancellazione chiamando il metodo() delete invece di remove() --- code/backend/nest_backend/routes/users/user_delete.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/backend/nest_backend/routes/users/user_delete.py b/code/backend/nest_backend/routes/users/user_delete.py index b3fe041..892e3fb 100644 --- a/code/backend/nest_backend/routes/users/user_delete.py +++ b/code/backend/nest_backend/routes/users/user_delete.py @@ -17,11 +17,12 @@ def page_user_delete(): user = find_user(get_jwt_identity()) if not user.isAdmin: return json_error("User is not admin."), 403 - target = find_user(request.json.get('email')) + deluser=request.json.get('email') + target = find_user(deluser) if not target: return json_error("User not found."), 404 if user == target: return json_error("The user cant delete himself. Its a sin."), 406 - Base.session.remove(target) + Base.session.delete(target) Base.session.commit() return json_success("The user has been deleted.")