mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 22:57:12 -04:00
* feat: workspace api * feat: added cloud apis for add and delete workspace * feat: add and delete workspace event handlers * chore: rust fmt * chore: save user workspace * test: add test * test: add test * chore: add to gitignore * feat: update api add name to workspace * chore: cargo clippy and rename to create * chore: add envrc and direnv to gitignore * chore: change name to create workspace instead of add workspace * chore: update client api rev * feat: add create workspace impl * chore: restore gitignore to original * test: fix create workspace event test * fix: change delete workspace input * fix: compile * fix: create workspace test * feat: add error code for request payload too large * chore: remove cargo backup files * feat: add is async option for upload file handler * chore: update client api version --------- Co-authored-by: nathan <nathan@appflowy.io>
56 lines
1.5 KiB
Rust
56 lines
1.5 KiB
Rust
use collab_entity::{CollabObject, CollabType};
|
|
use uuid::Uuid;
|
|
|
|
use flowy_user_pub::entities::AuthResponse;
|
|
use lib_infra::box_any::BoxAny;
|
|
|
|
use crate::supabase_test::util::{
|
|
collab_service, database_service, get_supabase_ci_config, third_party_sign_up_param,
|
|
user_auth_service,
|
|
};
|
|
|
|
#[tokio::test]
|
|
async fn supabase_create_database_test() {
|
|
if get_supabase_ci_config().is_none() {
|
|
return;
|
|
}
|
|
|
|
let user_service = user_auth_service();
|
|
let uuid = Uuid::new_v4().to_string();
|
|
let params = third_party_sign_up_param(uuid);
|
|
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
|
|
|
|
let collab_service = collab_service();
|
|
let database_service = database_service();
|
|
|
|
let mut row_ids = vec![];
|
|
for _i in 0..3 {
|
|
let row_id = uuid::Uuid::new_v4().to_string();
|
|
row_ids.push(row_id.clone());
|
|
let collab_object = CollabObject::new(
|
|
user.user_id,
|
|
row_id,
|
|
CollabType::DatabaseRow,
|
|
user.latest_workspace.id.clone(),
|
|
"fake_device_id".to_string(),
|
|
);
|
|
collab_service
|
|
.send_update(&collab_object, 0, vec![1, 2, 3])
|
|
.await
|
|
.unwrap();
|
|
collab_service
|
|
.send_update(&collab_object, 0, vec![4, 5, 6])
|
|
.await
|
|
.unwrap();
|
|
}
|
|
|
|
let updates_by_oid = database_service
|
|
.batch_get_database_object_doc_state(row_ids, CollabType::DatabaseRow, "fake_workspace_id")
|
|
.await
|
|
.unwrap();
|
|
|
|
assert_eq!(updates_by_oid.len(), 3);
|
|
for (_, update) in updates_by_oid {
|
|
assert_eq!(update.len(), 2);
|
|
}
|
|
}
|