mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: rename (#4551)
Co-authored-by: Richard Shiue <71320345+richardshiue@users.noreply.github.com>
This commit is contained in:
parent
f6242f1cc7
commit
0483e305e7
@ -73,7 +73,7 @@ impl UserStatusCallback for UserStatusCallbackImpl {
|
||||
.initialize(
|
||||
user_id,
|
||||
user_workspace.id.clone(),
|
||||
user_workspace.database_view_tracker_id,
|
||||
user_workspace.workspace_database_object_id,
|
||||
)
|
||||
.await?;
|
||||
document_manager
|
||||
@ -111,7 +111,7 @@ impl UserStatusCallback for UserStatusCallbackImpl {
|
||||
.initialize(
|
||||
user_id,
|
||||
user_workspace.id.clone(),
|
||||
user_workspace.database_view_tracker_id,
|
||||
user_workspace.workspace_database_object_id,
|
||||
)
|
||||
.await?;
|
||||
document_manager
|
||||
@ -197,7 +197,7 @@ impl UserStatusCallback for UserStatusCallbackImpl {
|
||||
.initialize_with_new_user(
|
||||
user_profile.uid,
|
||||
user_workspace.id.clone(),
|
||||
user_workspace.database_view_tracker_id,
|
||||
user_workspace.workspace_database_object_id,
|
||||
)
|
||||
.await
|
||||
.context("DatabaseManager error")?;
|
||||
@ -235,7 +235,7 @@ impl UserStatusCallback for UserStatusCallbackImpl {
|
||||
.initialize(
|
||||
user_id,
|
||||
user_workspace.id.clone(),
|
||||
user_workspace.database_view_tracker_id,
|
||||
user_workspace.workspace_database_object_id,
|
||||
)
|
||||
.await?;
|
||||
document_manager
|
||||
|
@ -80,7 +80,7 @@ impl DatabaseManager {
|
||||
&self,
|
||||
uid: i64,
|
||||
workspace_id: String,
|
||||
database_views_aggregate_id: String,
|
||||
workspace_database_object_id: String,
|
||||
) -> FlowyResult<()> {
|
||||
// Clear all existing tasks
|
||||
self.task_scheduler.write().await.clear_task();
|
||||
@ -98,12 +98,12 @@ impl DatabaseManager {
|
||||
let mut collab_raw_data = CollabDocState::default();
|
||||
|
||||
// If the workspace database not exist in disk, try to fetch from remote.
|
||||
if !self.is_collab_exist(uid, &collab_db, &database_views_aggregate_id) {
|
||||
if !self.is_collab_exist(uid, &collab_db, &workspace_database_object_id) {
|
||||
trace!("workspace database not exist, try to fetch from remote");
|
||||
match self
|
||||
.cloud_service
|
||||
.get_collab_doc_state_db(
|
||||
&database_views_aggregate_id,
|
||||
&workspace_database_object_id,
|
||||
CollabType::WorkspaceDatabase,
|
||||
&workspace_id,
|
||||
)
|
||||
@ -115,7 +115,7 @@ impl DatabaseManager {
|
||||
Err(err) => {
|
||||
return Err(FlowyError::record_not_found().with_context(format!(
|
||||
"get workspace database :{} failed: {}",
|
||||
database_views_aggregate_id, err,
|
||||
workspace_database_object_id, err,
|
||||
)));
|
||||
},
|
||||
}
|
||||
@ -125,11 +125,11 @@ impl DatabaseManager {
|
||||
event!(
|
||||
tracing::Level::INFO,
|
||||
"open aggregate database views object: {}",
|
||||
&database_views_aggregate_id
|
||||
&workspace_database_object_id
|
||||
);
|
||||
let collab = collab_builder.build_collab_with_config(
|
||||
uid,
|
||||
&database_views_aggregate_id,
|
||||
&workspace_database_object_id,
|
||||
CollabType::WorkspaceDatabase,
|
||||
collab_db.clone(),
|
||||
collab_raw_data,
|
||||
@ -152,10 +152,10 @@ impl DatabaseManager {
|
||||
&self,
|
||||
user_id: i64,
|
||||
workspace_id: String,
|
||||
database_views_aggregate_id: String,
|
||||
workspace_database_object_id: String,
|
||||
) -> FlowyResult<()> {
|
||||
self
|
||||
.initialize(user_id, workspace_id, database_views_aggregate_id)
|
||||
.initialize(user_id, workspace_id, workspace_database_object_id)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ fn to_user_workspace(af_workspace: AFWorkspace) -> UserWorkspace {
|
||||
id: af_workspace.workspace_id.to_string(),
|
||||
name: af_workspace.workspace_name,
|
||||
created_at: af_workspace.created_at,
|
||||
database_view_tracker_id: af_workspace.database_storage_id.to_string(),
|
||||
workspace_database_object_id: af_workspace.database_storage_id.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,6 +181,6 @@ fn make_user_workspace() -> UserWorkspace {
|
||||
id: uuid::Uuid::new_v4().to_string(),
|
||||
name: "My Workspace".to_string(),
|
||||
created_at: Default::default(),
|
||||
database_view_tracker_id: uuid::Uuid::new_v4().to_string(),
|
||||
workspace_database_object_id: uuid::Uuid::new_v4().to_string(),
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,10 @@ async fn supabase_user_sign_up_test() {
|
||||
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
|
||||
assert!(!user.latest_workspace.id.is_empty());
|
||||
assert!(!user.user_workspaces.is_empty());
|
||||
assert!(!user.latest_workspace.database_view_tracker_id.is_empty());
|
||||
assert!(!user
|
||||
.latest_workspace
|
||||
.workspace_database_object_id
|
||||
.is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -38,7 +41,10 @@ async fn supabase_user_sign_up_with_existing_uuid_test() {
|
||||
.unwrap();
|
||||
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
|
||||
assert!(!user.latest_workspace.id.is_empty());
|
||||
assert!(!user.latest_workspace.database_view_tracker_id.is_empty());
|
||||
assert!(!user
|
||||
.latest_workspace
|
||||
.workspace_database_object_id
|
||||
.is_empty());
|
||||
assert!(!user.user_workspaces.is_empty());
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ pub struct UserWorkspace {
|
||||
pub created_at: DateTime<Utc>,
|
||||
/// The database storage id is used indexing all the database views in current workspace.
|
||||
#[serde(rename = "database_storage_id")]
|
||||
pub database_view_tracker_id: String,
|
||||
pub workspace_database_object_id: String,
|
||||
}
|
||||
|
||||
impl UserWorkspace {
|
||||
@ -148,7 +148,7 @@ impl UserWorkspace {
|
||||
id: workspace_id.to_string(),
|
||||
name: "".to_string(),
|
||||
created_at: Utc::now(),
|
||||
database_view_tracker_id: Uuid::new_v4().to_string(),
|
||||
workspace_database_object_id: Uuid::new_v4().to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ impl<'de> Visitor<'de> for SessionVisitor {
|
||||
name: "My Workspace".to_string(),
|
||||
created_at: Utc::now(),
|
||||
// For historical reasons, the database_storage_id is constructed by the user_id.
|
||||
database_view_tracker_id: STANDARD.encode(format!("{}:user:database", user_id)),
|
||||
workspace_database_object_id: STANDARD.encode(format!("{}:user:database", user_id)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ pub fn migration_anon_user_on_sign_up(
|
||||
// Migration of all objects except the folder and database_with_views
|
||||
object_ids.retain(|id| {
|
||||
id != &old_user.session.user_workspace.id
|
||||
&& id != &old_user.session.user_workspace.database_view_tracker_id
|
||||
&& id != &old_user.session.user_workspace.workspace_database_object_id
|
||||
});
|
||||
|
||||
info!("migrate collab objects: {:?}", object_ids.len());
|
||||
@ -148,20 +148,20 @@ where
|
||||
{
|
||||
let database_with_views_collab = Collab::new(
|
||||
old_user.session.user_id,
|
||||
&old_user.session.user_workspace.database_view_tracker_id,
|
||||
&old_user.session.user_workspace.workspace_database_object_id,
|
||||
"phantom",
|
||||
vec![],
|
||||
);
|
||||
database_with_views_collab.with_origin_transact_mut(|txn| {
|
||||
old_collab_r_txn.load_doc_with_txn(
|
||||
old_user.session.user_id,
|
||||
&old_user.session.user_workspace.database_view_tracker_id,
|
||||
&old_user.session.user_workspace.workspace_database_object_id,
|
||||
txn,
|
||||
)
|
||||
})?;
|
||||
|
||||
let new_uid = new_user_session.user_id;
|
||||
let new_object_id = &new_user_session.user_workspace.database_view_tracker_id;
|
||||
let new_object_id = &new_user_session.user_workspace.workspace_database_object_id;
|
||||
|
||||
let array = DatabaseViewTrackerList::from_collab(&database_with_views_collab);
|
||||
for database_view_tracker in array.get_all_database_tracker() {
|
||||
|
@ -43,7 +43,7 @@ pub async fn sync_supabase_user_data_to_cloud(
|
||||
uid,
|
||||
&workspace_id,
|
||||
device_id,
|
||||
&new_user_session.user_workspace.database_view_tracker_id,
|
||||
&new_user_session.user_workspace.workspace_database_object_id,
|
||||
collab_db,
|
||||
user_service.clone(),
|
||||
)
|
||||
|
@ -127,7 +127,7 @@ pub(crate) fn import_appflowy_data_folder(
|
||||
// when doing import, we don't want to import the user workspace, database view tracker and the user awareness
|
||||
all_imported_object_ids.retain(|id| id != &imported_session.user_workspace.id);
|
||||
all_imported_object_ids
|
||||
.retain(|id| id != &imported_session.user_workspace.database_view_tracker_id);
|
||||
.retain(|id| id != &imported_session.user_workspace.workspace_database_object_id);
|
||||
all_imported_object_ids
|
||||
.retain(|id| id != &awareness_oid_from_user_uuid(&imported_session.user_uuid).to_string());
|
||||
|
||||
@ -268,14 +268,14 @@ where
|
||||
{
|
||||
let database_view_tracker_collab = Collab::new(
|
||||
other_session.user_id,
|
||||
&other_session.user_workspace.database_view_tracker_id,
|
||||
&other_session.user_workspace.workspace_database_object_id,
|
||||
"phantom",
|
||||
vec![],
|
||||
);
|
||||
database_view_tracker_collab.with_origin_transact_mut(|txn| {
|
||||
other_collab_read_txn.load_doc_with_txn(
|
||||
other_session.user_id,
|
||||
&other_session.user_workspace.database_view_tracker_id,
|
||||
&other_session.user_workspace.workspace_database_object_id,
|
||||
txn,
|
||||
)
|
||||
})?;
|
||||
|
@ -23,7 +23,7 @@ impl TryFrom<(i64, &UserWorkspace)> for UserWorkspaceTable {
|
||||
if value.1.id.is_empty() {
|
||||
return Err(FlowyError::invalid_data().with_context("The id is empty"));
|
||||
}
|
||||
if value.1.database_view_tracker_id.is_empty() {
|
||||
if value.1.workspace_database_object_id.is_empty() {
|
||||
return Err(FlowyError::invalid_data().with_context("The database storage id is empty"));
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ impl TryFrom<(i64, &UserWorkspace)> for UserWorkspaceTable {
|
||||
name: value.1.name.clone(),
|
||||
uid: value.0,
|
||||
created_at: value.1.created_at.timestamp(),
|
||||
database_storage_id: value.1.database_view_tracker_id.clone(),
|
||||
database_storage_id: value.1.workspace_database_object_id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -46,7 +46,7 @@ impl From<UserWorkspaceTable> for UserWorkspace {
|
||||
.timestamp_opt(value.created_at, 0)
|
||||
.single()
|
||||
.unwrap_or_default(),
|
||||
database_view_tracker_id: value.database_storage_id,
|
||||
workspace_database_object_id: value.database_storage_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user