diff --git a/models/behaviour/mail/oauth_v2.py b/models/behaviour/mail/oauth_v2.py index 5628776..51b3466 100644 --- a/models/behaviour/mail/oauth_v2.py +++ b/models/behaviour/mail/oauth_v2.py @@ -126,20 +126,22 @@ class MailOAuthModel(BaseModel): # Get the identifier from the database: mongo_json = await mongo_conn.find_one_and_update( collection = MailOAuthModel.AUTH_COLLECTION, - filter = { + filter = mongo_conn.dict_to_dot_notation({ "serviceType": "email", "user": { "entityId": user_info["entityId"], "billingAccountId": user_info["billingAccountId"] }, - "clientUserId": email_id - }, + "clientUserId": { + "email": email_id + } + }), update = { "$set": { "lastRequestTs": request_ts }, "$setOnInsert": { - "version": "1.1.0", + "version": "1.1.1", "serviceType": "email", "client": service_client, "authType": auth_type, @@ -213,10 +215,12 @@ class MailOAuthModel(BaseModel): # Save the token to MongoDB: mongo_json = await mongo_conn.find_one_and_update( collection = MailOAuthModel.AUTH_COLLECTION, - filter = { + filter = mongo_conn.dict_to_dot_notation({ "_id": ObjectId(account_identifier), - "clientUserId": email_id - }, + "clientUserId": { + "email": email_id + } + }), update = { "$set": { "token": token, @@ -288,6 +292,7 @@ class MailOAuthModel(BaseModel): "serviceType": True, "authType": True, "client": True, + "clientUserId": True, "token": True } )