diff options
author | Frederick Muriuki Muriithi | 2023-12-18 16:21:00 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-12-18 16:21:00 +0300 |
commit | 5a644ebea8bf9708ec89674e5789a88add56b440 (patch) | |
tree | dc9d86f1cea42f6a7b64b59ccc2fb11db318ef08 /gn_auth/auth/authorisation/users/collections/views.py | |
parent | 2290b274689114442c4fee87bfb1eb325c240c14 (diff) | |
download | gn-auth-5a644ebea8bf9708ec89674e5789a88add56b440.tar.gz |
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.
Diffstat (limited to 'gn_auth/auth/authorisation/users/collections/views.py')
-rw-r--r-- | gn_auth/auth/authorisation/users/collections/views.py | 5 |
1 files changed, 3 insertions, 2 deletions
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." }) |