(20241203) Testing the new account creation system. We now use a mix of 'entityId', 'billingAccountId', and the actual 'emailId' of the user to identify the unique account. This way one account with TCAOFF can have multiple e-mail ids.

This commit is contained in:
2024-12-03 08:30:46 +05:30
parent 384d037871
commit f8feeb4fc0
+12 -7
View File
@@ -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
}
)