Added better comments
This commit is contained in:
3
main.py
3
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'])
|
||||
|
||||
Reference in New Issue
Block a user