chore: refactor return response with object id (#494)
* chore: refactor return response with object id * chore: fix ci * chore: fix ci
This commit is contained in:
parent
5f970a625a
commit
a0593b5502
|
|
@ -1648,7 +1648,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cabc2b5d3e677393e5e7501bc07eb17b7b1643e6#cabc2b5d3e677393e5e7501bc07eb17b7b1643e6"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f8930ed1b19b65dd7b890df2b0db54048141e8c4#f8930ed1b19b65dd7b890df2b0db54048141e8c4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -1672,7 +1672,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-document"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cabc2b5d3e677393e5e7501bc07eb17b7b1643e6#cabc2b5d3e677393e5e7501bc07eb17b7b1643e6"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f8930ed1b19b65dd7b890df2b0db54048141e8c4#f8930ed1b19b65dd7b890df2b0db54048141e8c4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"collab",
|
||||
|
|
@ -1691,7 +1691,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cabc2b5d3e677393e5e7501bc07eb17b7b1643e6#cabc2b5d3e677393e5e7501bc07eb17b7b1643e6"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f8930ed1b19b65dd7b890df2b0db54048141e8c4#f8930ed1b19b65dd7b890df2b0db54048141e8c4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
|
@ -1706,7 +1706,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-folder"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cabc2b5d3e677393e5e7501bc07eb17b7b1643e6#cabc2b5d3e677393e5e7501bc07eb17b7b1643e6"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f8930ed1b19b65dd7b890df2b0db54048141e8c4#f8930ed1b19b65dd7b890df2b0db54048141e8c4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
|
|
|||
|
|
@ -209,10 +209,10 @@ debug = true
|
|||
# will be removed when using yrs 0.18.2 that expose pendings
|
||||
yrs = { git = "https://github.com/appflowy/y-crdt", rev = "3f25bb510ca5274e7657d3713fbed41fb46b4487" }
|
||||
|
||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cabc2b5d3e677393e5e7501bc07eb17b7b1643e6" }
|
||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cabc2b5d3e677393e5e7501bc07eb17b7b1643e6" }
|
||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cabc2b5d3e677393e5e7501bc07eb17b7b1643e6" }
|
||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cabc2b5d3e677393e5e7501bc07eb17b7b1643e6" }
|
||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f8930ed1b19b65dd7b890df2b0db54048141e8c4" }
|
||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f8930ed1b19b65dd7b890df2b0db54048141e8c4" }
|
||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f8930ed1b19b65dd7b890df2b0db54048141e8c4" }
|
||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f8930ed1b19b65dd7b890df2b0db54048141e8c4" }
|
||||
|
||||
[features]
|
||||
ai_enable = []
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ use bytes::Bytes;
|
|||
use client_api::collab_sync::{SinkConfig, SyncObject, SyncPlugin};
|
||||
use client_api::ws::{WSClient, WSClientConfig};
|
||||
use collab::core::collab::{DataSource, MutexCollab};
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::core::collab_state::SyncState;
|
||||
use collab::core::origin::{CollabClient, CollabOrigin};
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab::preclude::Collab;
|
||||
|
||||
use collab_entity::CollabType;
|
||||
|
|
@ -24,7 +24,8 @@ use database_entity::dto::{
|
|||
use mime::Mime;
|
||||
use serde_json::{json, Value};
|
||||
use shared_entity::dto::workspace_dto::{
|
||||
BlobMetadata, WorkspaceMemberChangeset, WorkspaceMemberInvitation, WorkspaceSpaceUsage,
|
||||
BlobMetadata, CollabResponse, WorkspaceMemberChangeset, WorkspaceMemberInvitation,
|
||||
WorkspaceSpaceUsage,
|
||||
};
|
||||
use shared_entity::response::AppResponseError;
|
||||
use std::collections::HashMap;
|
||||
|
|
@ -174,7 +175,7 @@ impl TestClient {
|
|||
Folder::from_collab_doc_state(
|
||||
uid,
|
||||
CollabOrigin::Empty,
|
||||
DataSource::DocStateV1(data.doc_state.to_vec()),
|
||||
DataSource::DocStateV1(data.encode_collab.doc_state.to_vec()),
|
||||
&workspace_id,
|
||||
vec![],
|
||||
)
|
||||
|
|
@ -456,6 +457,13 @@ impl TestClient {
|
|||
.await
|
||||
}
|
||||
|
||||
pub async fn get_collab(
|
||||
&mut self,
|
||||
query: QueryCollabParams,
|
||||
) -> Result<CollabResponse, AppResponseError> {
|
||||
self.api_client.get_collab(query).await
|
||||
}
|
||||
|
||||
pub async fn batch_get_collab(
|
||||
&mut self,
|
||||
workspace_id: &str,
|
||||
|
|
@ -746,7 +754,7 @@ pub async fn assert_server_collab(
|
|||
let json = Collab::new_with_source(
|
||||
CollabOrigin::Empty,
|
||||
&object_id,
|
||||
DataSource::DocStateV1(data.doc_state.to_vec()),
|
||||
DataSource::DocStateV1(data.encode_collab.doc_state.to_vec()),
|
||||
vec![],
|
||||
false,
|
||||
)
|
||||
|
|
@ -867,7 +875,7 @@ pub async fn get_collab_json_from_server(
|
|||
Collab::new_with_source(
|
||||
CollabOrigin::Empty,
|
||||
object_id,
|
||||
DataSource::DocStateV1(bytes.doc_state.to_vec()),
|
||||
DataSource::DocStateV1(bytes.encode_collab.doc_state.to_vec()),
|
||||
vec![],
|
||||
false,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use client_api::entity::AFUserProfile;
|
||||
use client_api::error::{AppResponseError, ErrorCode};
|
||||
use collab_entity::CollabType;
|
||||
use collab_rt_entity::EncodedCollab;
|
||||
use collab_entity::{CollabType, EncodedCollab};
|
||||
use database_entity::dto::{QueryCollab, QueryCollabParams};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ impl ClientAPI {
|
|||
) -> Result<ClientEncodeCollab, ClientResponse> {
|
||||
tracing::debug!("get_collab: {:?}", params);
|
||||
match self.client.get_collab(params.into()).await {
|
||||
Ok(data) => Ok(ClientEncodeCollab::from(data)),
|
||||
Ok(data) => Ok(ClientEncodeCollab::from(data.encode_collab)),
|
||||
Err(err) => Err(ClientResponse::from(err)),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ use crate::{RefreshTokenAction, RefreshTokenRetryCondition};
|
|||
use anyhow::anyhow;
|
||||
use app_error::AppError;
|
||||
use async_trait::async_trait;
|
||||
use collab_rt_entity::EncodedCollab;
|
||||
use collab_rt_entity::HttpRealtimeMessage;
|
||||
use database_entity::dto::{CollabParams, QueryCollabParams};
|
||||
use futures_util::stream;
|
||||
use prost::Message;
|
||||
use reqwest::{Body, Method};
|
||||
use shared_entity::dto::workspace_dto::CollabResponse;
|
||||
use shared_entity::response::{AppResponse, AppResponseError};
|
||||
use std::future::Future;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
|
@ -25,7 +25,7 @@ impl Client {
|
|||
pub async fn get_collab(
|
||||
&self,
|
||||
params: QueryCollabParams,
|
||||
) -> Result<EncodedCollab, AppResponseError> {
|
||||
) -> Result<CollabResponse, AppResponseError> {
|
||||
info!("get collab:{}", params);
|
||||
// 2 seconds, 4 seconds, 8 seconds
|
||||
let retry_strategy = ExponentialBackoff::from_millis(2).factor(1000).take(3);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,12 @@ use crate::ws::{
|
|||
use crate::Client;
|
||||
use app_error::gotrue::GoTrueError;
|
||||
use client_websocket::{connect_async, WebSocketStream};
|
||||
use collab_rt_entity::EncodedCollab;
|
||||
use database_entity::dto::QueryCollabParams;
|
||||
use gotrue::grant::{Grant, RefreshTokenGrant};
|
||||
use parking_lot::RwLock;
|
||||
use reqwest::header::HeaderMap;
|
||||
use reqwest::Method;
|
||||
use shared_entity::dto::workspace_dto::CollabTypeParam;
|
||||
use shared_entity::dto::workspace_dto::{CollabResponse, CollabTypeParam};
|
||||
use shared_entity::response::{AppResponse, AppResponseError};
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
|
@ -171,7 +170,7 @@ impl GetCollabAction {
|
|||
|
||||
impl Action for GetCollabAction {
|
||||
type Future = Pin<Box<dyn Future<Output = Result<Self::Item, Self::Error>> + Send + Sync>>;
|
||||
type Item = EncodedCollab;
|
||||
type Item = CollabResponse;
|
||||
type Error = AppResponseError;
|
||||
|
||||
fn run(&mut self) -> Self::Future {
|
||||
|
|
@ -191,7 +190,7 @@ impl Action for GetCollabAction {
|
|||
.send()
|
||||
.await?;
|
||||
log_request_id(&resp);
|
||||
let resp = AppResponse::<EncodedCollab>::from_response(resp).await?;
|
||||
let resp = AppResponse::<CollabResponse>::from_response(resp).await?;
|
||||
resp.into_data()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ use again::RetryPolicy;
|
|||
use app_error::gotrue::GoTrueError;
|
||||
use app_error::{AppError, ErrorCode};
|
||||
use async_trait::async_trait;
|
||||
use collab_rt_entity::EncodedCollab;
|
||||
use collab_entity::EncodedCollab;
|
||||
use database_entity::dto::{CollabParams, QueryCollabParams};
|
||||
use gotrue::grant::{Grant, RefreshTokenGrant};
|
||||
use reqwest::Method;
|
||||
use shared_entity::dto::workspace_dto::CollabTypeParam;
|
||||
use shared_entity::dto::workspace_dto::{CollabResponse, CollabTypeParam};
|
||||
use shared_entity::response::{AppResponse, AppResponseError};
|
||||
use std::future::Future;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
|
@ -34,7 +34,7 @@ impl Client {
|
|||
pub async fn get_collab(
|
||||
&self,
|
||||
params: QueryCollabParams,
|
||||
) -> Result<EncodedCollab, AppResponseError> {
|
||||
) -> Result<CollabResponse, AppResponseError> {
|
||||
let url = format!(
|
||||
"{}/api/workspace/v1/{}/collab/{}",
|
||||
self.base_url, ¶ms.workspace_id, ¶ms.object_id
|
||||
|
|
@ -47,7 +47,7 @@ impl Client {
|
|||
.send()
|
||||
.await?;
|
||||
log_request_id(&resp);
|
||||
let resp = AppResponse::<EncodedCollab>::from_response(resp).await?;
|
||||
let resp = AppResponse::<CollabResponse>::from_response(resp).await?;
|
||||
resp.into_data()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ pub mod realtime_proto;
|
|||
mod server_message;
|
||||
|
||||
pub use client_message::*;
|
||||
pub use collab::core::collab_plugin::EncodedCollab;
|
||||
pub use message::*;
|
||||
pub use realtime_proto::*;
|
||||
pub use server_message::*;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use app_error::AppError;
|
||||
use async_trait::async_trait;
|
||||
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use database_entity::dto::{
|
||||
AFAccessLevel, AFSnapshotMeta, AFSnapshotMetas, CollabParams, InsertSnapshotParams, QueryCollab,
|
||||
QueryCollabParams, QueryCollabResult, SnapshotData,
|
||||
};
|
||||
|
||||
use collab::entity::EncodedCollab;
|
||||
use sqlx::Transaction;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use collab_entity::CollabType;
|
||||
use collab_entity::{CollabType, EncodedCollab};
|
||||
use database_entity::dto::{AFRole, AFWorkspaceInvitationStatus};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::ops::Deref;
|
||||
|
|
@ -106,3 +106,10 @@ pub struct PatchWorkspaceParam {
|
|||
pub struct CollabTypeParam {
|
||||
pub collab_type: CollabType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CollabResponse {
|
||||
#[serde(flatten)]
|
||||
pub encode_collab: EncodedCollab,
|
||||
pub object_id: String,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ use crate::hierarchy_builder::{FlattedViews, WorkspaceViewBuilder};
|
|||
pub use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use collab::core::collab::MutexCollab;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::core::origin::CollabOrigin;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab::preclude::Collab;
|
||||
use collab_entity::CollabType;
|
||||
use collab_folder::{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::group::cmd::{GroupCommand, GroupCommandSender};
|
||||
use crate::rt_server::rt_spawn;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::entity::EncodedCollab;
|
||||
use dashmap::DashMap;
|
||||
use std::sync::Arc;
|
||||
use tracing::error;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ use crate::error::RealtimeError;
|
|||
use async_trait::async_trait;
|
||||
|
||||
use collab::core::collab::DataSource;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::core::origin::CollabOrigin;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab::preclude::Collab;
|
||||
use collab_entity::CollabType;
|
||||
use database_entity::dto::CollabParams;
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ use crate::error::RealtimeError;
|
|||
use crate::group::manager::GroupManager;
|
||||
use crate::RealtimeAccessControl;
|
||||
use async_stream::stream;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab_rt_entity::user::RealtimeUser;
|
||||
use collab_rt_entity::{ClientCollabMessage, ServerCollabMessage, SinkMessage};
|
||||
use collab_rt_entity::{CollabAck, RealtimeMessage};
|
||||
use dashmap::DashMap;
|
||||
use database::collab::CollabStorage;
|
||||
|
||||
use collab::entity::EncodedCollab;
|
||||
use futures_util::StreamExt;
|
||||
use std::sync::Arc;
|
||||
use tracing::{error, instrument, trace, warn};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::core::origin::CollabOrigin;
|
||||
use collab_entity::CollabType;
|
||||
use dashmap::DashMap;
|
||||
|
|
@ -18,6 +17,7 @@ use crate::rt_server::rt_spawn;
|
|||
use collab::core::collab::MutexCollab;
|
||||
use futures_util::{SinkExt, StreamExt};
|
||||
|
||||
use collab::entity::EncodedCollab;
|
||||
use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU32, Ordering};
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::{event, trace};
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ use crate::metrics::CollabMetricsCalculate;
|
|||
use crate::RealtimeAccessControl;
|
||||
use app_error::AppError;
|
||||
use collab::core::collab::{DataSource, MutexCollab};
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::core::origin::CollabOrigin;
|
||||
|
||||
use crate::group::plugin::HistoryPlugin;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab::preclude::{Collab, CollabPlugin};
|
||||
use collab_entity::CollabType;
|
||||
use collab_rt_entity::user::RealtimeUser;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ use anyhow::{anyhow, Context};
|
|||
use app_error::AppError;
|
||||
use appflowy_collaborate::data_validation::{validate_encode_collab, CollabValidator};
|
||||
use bytes::BytesMut;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab_entity::CollabType;
|
||||
|
||||
use collab_rt_entity::realtime_proto::HttpRealtimeMessage;
|
||||
|
|
@ -606,19 +605,26 @@ async fn get_collab_handler(
|
|||
user_uuid: UserUuid,
|
||||
payload: Json<QueryCollabParams>,
|
||||
state: Data<AppState>,
|
||||
) -> Result<Json<AppResponse<EncodedCollab>>> {
|
||||
) -> Result<Json<AppResponse<CollabResponse>>> {
|
||||
let uid = state
|
||||
.user_cache
|
||||
.get_user_uid(&user_uuid)
|
||||
.await
|
||||
.map_err(AppResponseError::from)?;
|
||||
let data = state
|
||||
let params = payload.into_inner();
|
||||
let object_id = params.object_id.clone();
|
||||
let encode_collab = state
|
||||
.collab_access_control_storage
|
||||
.get_encode_collab(&uid, payload.into_inner(), false)
|
||||
.get_encode_collab(&uid, params, false)
|
||||
.await
|
||||
.map_err(AppResponseError::from)?;
|
||||
|
||||
Ok(Json(AppResponse::Ok().with_data(data)))
|
||||
let resp = CollabResponse {
|
||||
encode_collab,
|
||||
object_id,
|
||||
};
|
||||
|
||||
Ok(Json(AppResponse::Ok().with_data(resp)))
|
||||
}
|
||||
|
||||
async fn v1_get_collab_handler(
|
||||
|
|
@ -626,7 +632,7 @@ async fn v1_get_collab_handler(
|
|||
path: web::Path<(String, String)>,
|
||||
query: web::Query<CollabTypeParam>,
|
||||
state: Data<AppState>,
|
||||
) -> Result<Json<AppResponse<EncodedCollab>>> {
|
||||
) -> Result<Json<AppResponse<CollabResponse>>> {
|
||||
let (workspace_id, object_id) = path.into_inner();
|
||||
let collab_type = query.into_inner().collab_type;
|
||||
let uid = state
|
||||
|
|
@ -638,18 +644,23 @@ async fn v1_get_collab_handler(
|
|||
let param = QueryCollabParams {
|
||||
workspace_id,
|
||||
inner: QueryCollab {
|
||||
object_id,
|
||||
object_id: object_id.clone(),
|
||||
collab_type,
|
||||
},
|
||||
};
|
||||
|
||||
let data = state
|
||||
let encode_collab = state
|
||||
.collab_access_control_storage
|
||||
.get_encode_collab(&uid, param, false)
|
||||
.await
|
||||
.map_err(AppResponseError::from)?;
|
||||
|
||||
Ok(Json(AppResponse::Ok().with_data(data)))
|
||||
let resp = CollabResponse {
|
||||
encode_collab,
|
||||
object_id,
|
||||
};
|
||||
|
||||
Ok(Json(AppResponse::Ok().with_data(resp)))
|
||||
}
|
||||
|
||||
#[instrument(level = "trace", skip_all, err)]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
use crate::biz::collab::disk_cache::CollabDiskCache;
|
||||
use crate::biz::collab::mem_cache::CollabMemCache;
|
||||
use app_error::AppError;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
|
||||
use crate::state::RedisConnectionManager;
|
||||
|
||||
use app_error::AppError;
|
||||
use collab::entity::EncodedCollab;
|
||||
use database_entity::dto::{CollabParams, QueryCollab, QueryCollabResult};
|
||||
use futures_util::{stream, StreamExt};
|
||||
use itertools::{Either, Itertools};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::anyhow;
|
||||
use app_error::AppError;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::entity::EncodedCollab;
|
||||
use database::collab::{
|
||||
batch_select_collab_blob, insert_into_af_collab, is_collab_exists, select_blob_from_af_collab,
|
||||
AppResult,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::state::RedisConnectionManager;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::entity::EncodedCollab;
|
||||
use redis::{pipe, AsyncCommands};
|
||||
|
||||
use anyhow::anyhow;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use crate::biz::snapshot::SnapshotControl;
|
|||
use app_error::AppError;
|
||||
use async_trait::async_trait;
|
||||
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::entity::EncodedCollab;
|
||||
|
||||
use appflowy_collaborate::command::{RTCommand, RTCommandSender};
|
||||
use database::collab::{AppResult, CollabStorage, CollabStorageAccessControl};
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
filters.push(format!("database={}", level));
|
||||
filters.push(format!("storage={}", level));
|
||||
filters.push(format!("gotrue={}", level));
|
||||
filters.push(format!("appflowy_collaborate={}", level));
|
||||
|
||||
// Load environment variables from .env file
|
||||
dotenvy::dotenv().ok();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use app_error::ErrorCode;
|
||||
use assert_json_diff::assert_json_include;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab_document::document_data::default_document_collab_data;
|
||||
use collab_entity::CollabType;
|
||||
use database_entity::dto::{
|
||||
|
|
@ -17,6 +17,27 @@ use client_api_test_util::TestClient;
|
|||
use shared_entity::response::AppResponse;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[tokio::test]
|
||||
async fn get_collab_response_compatible_test() {
|
||||
let mut test_client = TestClient::new_user().await;
|
||||
let workspace_id = test_client.workspace_id().await;
|
||||
|
||||
let params = QueryCollabParams {
|
||||
workspace_id: workspace_id.clone(),
|
||||
inner: QueryCollab {
|
||||
object_id: workspace_id.clone(),
|
||||
collab_type: CollabType::Folder,
|
||||
},
|
||||
};
|
||||
// after 0.3.22, we use [CollabResponse] instead of EncodedCollab as the response
|
||||
let data = test_client.get_collab(params).await.unwrap();
|
||||
assert_eq!(data.object_id, workspace_id);
|
||||
|
||||
let json = serde_json::to_value(data.clone()).unwrap();
|
||||
let encode_collab: EncodedCollab = serde_json::from_value(json).unwrap();
|
||||
assert_eq!(data.encode_collab, encode_collab);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn batch_insert_collab_with_empty_payload_test() {
|
||||
let mut test_client = TestClient::new_user().await;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use appflowy_cloud::biz::collab::cache::CollabCache;
|
|||
use appflowy_cloud::biz::collab::queue::StorageQueue;
|
||||
use appflowy_cloud::biz::collab::WritePriority;
|
||||
use client_api_test_util::setup_log;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab_entity::CollabType;
|
||||
use database_entity::dto::{CollabParams, QueryCollab};
|
||||
use sqlx::PgPool;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use app_error::ErrorCode;
|
|||
use appflowy_cloud::biz::collab::mem_cache::CollabMemCache;
|
||||
|
||||
use client_api_test_util::*;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab_entity::CollabType;
|
||||
use database_entity::dto::{
|
||||
CreateCollabParams, DeleteCollabParams, QueryCollab, QueryCollabParams, QueryCollabResult,
|
||||
|
|
@ -37,6 +37,7 @@ async fn success_insert_collab_test() {
|
|||
))
|
||||
.await
|
||||
.unwrap()
|
||||
.encode_collab
|
||||
.doc_state;
|
||||
|
||||
assert_eq!(doc_state, encode_collab.doc_state);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Context;
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::core::origin::CollabOrigin;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab::preclude::Collab;
|
||||
|
||||
use rand::distributions::Alphanumeric;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use anyhow::Error;
|
||||
use assert_json_diff::assert_json_eq;
|
||||
use collab::core::collab::{DataSource, MutexCollab};
|
||||
use collab::core::collab_plugin::EncodedCollab;
|
||||
use collab::core::origin::CollabOrigin;
|
||||
use collab::entity::EncodedCollab;
|
||||
use collab::preclude::Collab;
|
||||
use collab_entity::CollabType;
|
||||
use serde_json::{json, Value};
|
||||
|
|
|
|||
Loading…
Reference in New Issue