1
This commit is contained in:
@@ -33,6 +33,12 @@ pub struct AuthStoreSnapshotProcedureResult {
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
fn normalize_user_account_tags(
|
||||
tags: Option<Vec<String>>,
|
||||
) -> Result<Vec<String>, module_runtime::RuntimeProfileFieldError> {
|
||||
module_runtime::normalize_profile_user_tags(tags.unwrap_or_default())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct AuthStoreSnapshotImportRecord {
|
||||
pub imported_user_count: u32,
|
||||
@@ -210,8 +216,10 @@ fn import_auth_store_snapshot_tx(
|
||||
password_hash: stored_user.password_hash,
|
||||
password_login_enabled: stored_user.password_login_enabled,
|
||||
token_version: user.token_version,
|
||||
user_tags: module_runtime::normalize_profile_user_tags(user.user_tags)
|
||||
.map_err(|error| error.to_string())?,
|
||||
user_tags: Some(
|
||||
module_runtime::normalize_profile_user_tags(user.user_tags)
|
||||
.map_err(|error| error.to_string())?,
|
||||
),
|
||||
});
|
||||
imported_user_count += 1;
|
||||
|
||||
@@ -341,7 +349,8 @@ fn export_auth_store_snapshot_from_tables_tx(
|
||||
binding_status: user.binding_status,
|
||||
wechat_bound: user.wechat_bound,
|
||||
token_version: user.token_version,
|
||||
user_tags: user.user_tags,
|
||||
user_tags: normalize_user_account_tags(user.user_tags)
|
||||
.map_err(|error| error.to_string())?,
|
||||
};
|
||||
users_by_username.insert(
|
||||
user.username,
|
||||
|
||||
@@ -28,7 +28,8 @@ pub struct UserAccount {
|
||||
pub(crate) password_hash: String,
|
||||
pub(crate) password_login_enabled: bool,
|
||||
pub(crate) token_version: u64,
|
||||
pub(crate) user_tags: Vec<String>,
|
||||
#[default(None::<Vec<String>>)]
|
||||
pub(crate) user_tags: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[spacetimedb::table(
|
||||
|
||||
Reference in New Issue
Block a user