From 0e7fb3cfcfe041c462a44dfd02279ffba6ce38b0 Mon Sep 17 00:00:00 2001 From: jackeilles Date: Mon, 26 Feb 2024 20:21:34 +0000 Subject: [PATCH] dict name wrong --- app/worker.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/app/worker.py b/app/worker.py index d76a521..e301806 100644 --- a/app/worker.py +++ b/app/worker.py @@ -120,6 +120,48 @@ def idInfo(id): # Return the mongodb info about the file, removing IP if its present return check +<<<<<<< HEAD +======= +def userInfo(id): + # Grab user entry from userID + user = Config.users.find_one({"userid": id}) + + username = user['user'] + userid = id + + # Search for all files from that userID + files = Config.files.find({"userid": userid}, {"_id": False, "ip": False}) + list = {} + + # Create file listing + for file in files: + list.update({ + file["id"]: { + "filename": file["filename"], + "mimetype": file["mimetype"], + "filesize": file["filesize"], + "retention": file["retention"], + "creation": file["date"], + "expiry": file["expiry"] + } + }) + + # Search for all URL's from that userID + url = Config.url.find({"userid": userid}) + + # Format all into one JSON + return { + "user": { + "username": username, + "userid": userid + }, + "files": { + "count": len(files), + "list": list + } + } + +>>>>>>> 3063133 (dict name wrong) def randomHex(): hexRand = ''.join(secrets.choice('0123456789abcdef') for _ in range(6)) return hexRand