aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/redis_tools.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/utility/redis_tools.py')
-rw-r--r--wqflask/utility/redis_tools.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py
index ca42f7b7..3db37223 100644
--- a/wqflask/utility/redis_tools.py
+++ b/wqflask/utility/redis_tools.py
@@ -28,6 +28,20 @@ def get_user_id(column_name, column_value):
return None
+def get_resource_id_by_data(res_type, res_data):
+ resource_list = Redis.hgetall("resources")
+ for key in resource_list:
+ resource_ob = json.loads(resource_list[key])
+
+ logger.info(resource_ob["data"])
+ if resource_ob["type"] == res_type and resource_ob["data"] == res_data:
+ return key
+
+ return None
+
+def get_resource(resource_id):
+ return json.loads(Redis.hget("resources", resource_id))
+
def get_user_by_unique_column(column_name, column_value):
item_details = None
@@ -167,4 +181,4 @@ def change_group_name(user_id, group_id, new_name):
group_info["name"] = new_name
return group_info
else:
- return None \ No newline at end of file
+ return None