@@ -196,6 +196,11 @@ def register_onplat(self, platform: Platform, user_token: str) -> RootUserRegist
196
196
return RootUserRegistrationResult (WriteOutcome .X_ON_CONN_ONPLAT , ex , model , outcome , user_reg_result )
197
197
198
198
if outcome == WriteOutcome .O_DATA_EXISTS :
199
+ # `model` may not be as same as the one returned from `self.insert_one_data()`
200
+ model = self .get_root_data_oid (model .id )
201
+ if not model :
202
+ raise ValueError (f"Data of root OID { model .id } not found while it should be found." )
203
+
199
204
return RootUserRegistrationResult (WriteOutcome .O_DATA_EXISTS , ex , model , outcome , user_reg_result )
200
205
201
206
return RootUserRegistrationResult (WriteOutcome .O_INSERTED , ex , model , outcome , user_reg_result )
@@ -224,11 +229,16 @@ def register_google(self, id_data: GoogleIdentityUserData) -> RootUserRegistrati
224
229
return RootUserRegistrationResult (WriteOutcome .X_ON_CONN_API , ex , model , outcome , user_reg_result )
225
230
226
231
if outcome == WriteOutcome .O_DATA_EXISTS :
227
- # Updating the email per the documentation
232
+ # Updating the email per the Google Identity documentation
228
233
APIUserManager .update_many_async ({APIUserModel .GoogleUid .key : id_data .uid ,
229
234
APIUserModel .Email .key : {"$ne" : id_data .email }},
230
235
{"$set" : {APIUserModel .Email .key : id_data .email }})
231
236
237
+ # `model` may not be as same as the one returned from `self.insert_one_data()`
238
+ model = self .get_root_data_oid (model .id )
239
+ if not model :
240
+ raise ValueError (f"Data of root OID { model .id } not found while it should be found." )
241
+
232
242
return RootUserRegistrationResult (WriteOutcome .O_DATA_EXISTS , ex , model , outcome , user_reg_result )
233
243
234
244
return RootUserRegistrationResult (WriteOutcome .O_INSERTED , ex , model , outcome , user_reg_result )
0 commit comments