mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
* chore: refactor the publish code * feat: integrate publish into database page * feat: add publish database structure * feat: add database row collab * feat: publish the database row collabs * chore: update collab * chore: improve question bubble * feat: publish the database relations * fix: rust ci * feat: select grid view to publish * feat: unable to deselect the primary database * feat: optimize the read recent views speed (#5726) * feat: optimize the read recent views speed * fix: order of recent views should be from the latest to the oldest * chore: update translations * fix: replace the unable to be selected icon * feat: remove left padding of inline database * fix: code review * chore: remove publish api err log * chore: read the database collab and document collab from disk instead of memory * chore: code cleanup * chore: revert beta.appflowy.com * chore: code cleanup * test: add database encode test * test: add publish database test * chore: refresh sidebar layout * chore: update comments
96 lines
2.4 KiB
Rust
96 lines
2.4 KiB
Rust
pub use anyhow::Error;
|
|
use collab_entity::CollabType;
|
|
pub use collab_folder::{Folder, FolderData, Workspace};
|
|
use uuid::Uuid;
|
|
|
|
use crate::entities::{PublishInfoResponse, PublishPayload};
|
|
use lib_infra::future::FutureResult;
|
|
|
|
/// [FolderCloudService] represents the cloud service for folder.
|
|
pub trait FolderCloudService: Send + Sync + 'static {
|
|
/// Creates a new workspace for the user.
|
|
/// Returns error if the cloud service doesn't support multiple workspaces
|
|
fn create_workspace(&self, uid: i64, name: &str) -> FutureResult<Workspace, Error>;
|
|
|
|
fn open_workspace(&self, workspace_id: &str) -> FutureResult<(), Error>;
|
|
|
|
/// Returns all workspaces of the user.
|
|
/// Returns vec![] if the cloud service doesn't support multiple workspaces
|
|
fn get_all_workspace(&self) -> FutureResult<Vec<WorkspaceRecord>, Error>;
|
|
|
|
fn get_folder_data(
|
|
&self,
|
|
workspace_id: &str,
|
|
uid: &i64,
|
|
) -> FutureResult<Option<FolderData>, Error>;
|
|
|
|
fn get_folder_snapshots(
|
|
&self,
|
|
workspace_id: &str,
|
|
limit: usize,
|
|
) -> FutureResult<Vec<FolderSnapshot>, Error>;
|
|
|
|
fn get_folder_doc_state(
|
|
&self,
|
|
workspace_id: &str,
|
|
uid: i64,
|
|
collab_type: CollabType,
|
|
object_id: &str,
|
|
) -> FutureResult<Vec<u8>, Error>;
|
|
|
|
fn batch_create_folder_collab_objects(
|
|
&self,
|
|
workspace_id: &str,
|
|
objects: Vec<FolderCollabParams>,
|
|
) -> FutureResult<(), Error>;
|
|
|
|
fn service_name(&self) -> String;
|
|
|
|
fn publish_view(
|
|
&self,
|
|
workspace_id: &str,
|
|
payload: Vec<PublishPayload>,
|
|
) -> FutureResult<(), Error>;
|
|
|
|
fn unpublish_views(&self, workspace_id: &str, view_ids: Vec<String>) -> FutureResult<(), Error>;
|
|
|
|
fn get_publish_info(&self, view_id: &str) -> FutureResult<PublishInfoResponse, Error>;
|
|
|
|
fn set_publish_namespace(
|
|
&self,
|
|
workspace_id: &str,
|
|
new_namespace: &str,
|
|
) -> FutureResult<(), Error>;
|
|
|
|
fn get_publish_namespace(&self, workspace_id: &str) -> FutureResult<String, Error>;
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct FolderCollabParams {
|
|
pub object_id: String,
|
|
pub encoded_collab_v1: Vec<u8>,
|
|
pub collab_type: CollabType,
|
|
}
|
|
|
|
pub struct FolderSnapshot {
|
|
pub snapshot_id: i64,
|
|
pub database_id: String,
|
|
pub data: Vec<u8>,
|
|
pub created_at: i64,
|
|
}
|
|
|
|
pub fn gen_workspace_id() -> Uuid {
|
|
uuid::Uuid::new_v4()
|
|
}
|
|
|
|
pub fn gen_view_id() -> Uuid {
|
|
uuid::Uuid::new_v4()
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct WorkspaceRecord {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub created_at: i64,
|
|
}
|