Enrich external API failure audit metadata
This commit is contained in:
@@ -66,7 +66,10 @@ fn upsert_auth_snapshot_row(
|
||||
.find(&snapshot_id)
|
||||
.is_some()
|
||||
{
|
||||
ctx.db.auth_store_snapshot().snapshot_id().delete(&snapshot_id);
|
||||
ctx.db
|
||||
.auth_store_snapshot()
|
||||
.snapshot_id()
|
||||
.delete(&snapshot_id);
|
||||
}
|
||||
|
||||
ctx.db.auth_store_snapshot().insert(AuthStoreSnapshot {
|
||||
@@ -106,7 +109,10 @@ fn auth_store_snapshot_wechat_row_id(provider_uid: &str, user_id: &str) -> Strin
|
||||
}
|
||||
|
||||
fn auth_store_snapshot_union_row_id(union_id: &str, user_id: &str) -> String {
|
||||
prefixed_snapshot_id(AUTH_STORE_SNAPSHOT_UNION_PREFIX, &format!("{union_id}|{user_id}"))
|
||||
prefixed_snapshot_id(
|
||||
AUTH_STORE_SNAPSHOT_UNION_PREFIX,
|
||||
&format!("{union_id}|{user_id}"),
|
||||
)
|
||||
}
|
||||
|
||||
fn snapshot_has_user_rows(snapshot: &PersistentAuthStoreSnapshot) -> bool {
|
||||
@@ -202,13 +208,7 @@ fn import_auth_store_snapshot_json_value_tx(
|
||||
for stored_user in parsed.users_by_username.into_values() {
|
||||
let user = stored_user.user;
|
||||
let user_id = user.id.clone();
|
||||
if ctx
|
||||
.db
|
||||
.user_account()
|
||||
.user_id()
|
||||
.find(&user_id)
|
||||
.is_some()
|
||||
{
|
||||
if ctx.db.user_account().user_id().find(&user_id).is_some() {
|
||||
ctx.db.user_account().user_id().delete(&user_id);
|
||||
}
|
||||
ctx.db.user_account().insert(UserAccount {
|
||||
@@ -644,10 +644,7 @@ mod tests {
|
||||
|
||||
PersistentAuthStoreSnapshot {
|
||||
next_user_id: 43,
|
||||
users_by_username: std::collections::HashMap::from([(
|
||||
"phone_42".to_string(),
|
||||
user,
|
||||
)]),
|
||||
users_by_username: std::collections::HashMap::from([("phone_42".to_string(), user)]),
|
||||
phone_to_user_id: std::collections::HashMap::from([(
|
||||
"+8613800008000".to_string(),
|
||||
"user_00000042".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user