From 5a644ebea8bf9708ec89674e5789a88add56b440 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Dec 2023 16:21:00 +0300 Subject: Provide the correct Redis key Previously, when the user would request to either import or delete the collections they had created before logging in, the system would try deleting the collections from the wrong key, leading to the collections still showing up. This commit fixes that by providing the code with the correct Redis key to act upon. --- gn_auth/auth/authorisation/users/collections/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gn_auth/auth/authorisation/users/collections/views.py') diff --git a/gn_auth/auth/authorisation/users/collections/views.py b/gn_auth/auth/authorisation/users/collections/views.py index a1cc30d..6c68b35 100644 --- a/gn_auth/auth/authorisation/users/collections/views.py +++ b/gn_auth/auth/authorisation/users/collections/views.py @@ -21,6 +21,7 @@ from .models import ( user_collections, save_collections, create_collection, + REDIS_COLLECTIONS_KEY, delete_collections as _delete_collections) collections = Blueprint("collections", __name__) @@ -116,7 +117,7 @@ def import_anonymous() -> Response: token.user, (user_collections(redisconn, token.user) + anon_colls)) - redisconn.hdel("collections", str(anon_id)) + redisconn.hdel(REDIS_COLLECTIONS_KEY, str(anon_id)) return jsonify({ "message": f"Import of {len(anon_colls)} was successful." }) @@ -132,7 +133,7 @@ def delete_anonymous() -> Response: anon_id = UUID(request.json.get("anon_id"))#type: ignore[union-attr] anon_colls = user_collections(redisconn, User( anon_id, "anon@ymous.user", "Anonymous User")) - redisconn.hdel("collections", str(anon_id)) + redisconn.hdel(REDIS_COLLECTIONS_KEY, str(anon_id)) return jsonify({ "message": f"Deletion of {len(anon_colls)} was successful." }) -- cgit v1.2.3