Added better comments

This commit is contained in:
2025-08-22 19:43:18 +01:00
parent 56b74360f0
commit 349a4192e0

View File

@@ -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'])