From 349a4192e0fba85678d8cfa49691a2a57de086fd Mon Sep 17 00:00:00 2001 From: Hugo H Date: Fri, 22 Aug 2025 19:43:18 +0100 Subject: [PATCH] Added better comments --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 4febdc3..7ce6cbb 100644 --- a/main.py +++ b/main.py @@ -113,8 +113,11 @@ def createChat(): user = usersCollection.find_one({'tokens.token': token}, {"_id":1,"tokens":{"$elemMatch": {"token":token}}}) # If the user exists, continue, otherwise return fail if (user): + # Convert _id to a string, python doesn't like ObjectId() user['_id'] = str(user['_id']) + # Check if the token expiry is after the current date (Using unix timestamp, other mongodb Date datatype is a pain to use in python) if (user['tokens'][0]['expiry'] > int(datetime.now().timestamp())): + # Store the userId userId = user['_id'] print(user) print(user['permissions'])