mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: support publish view and unpublish views
This commit is contained in:
@ -12,6 +12,7 @@ collab = { workspace = true }
|
||||
collab-entity = { workspace = true }
|
||||
uuid.workspace = true
|
||||
anyhow.workspace = true
|
||||
serde = { version = "1.0.202", features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio.workspace = true
|
||||
|
@ -3,6 +3,7 @@ use collab_entity::CollabType;
|
||||
pub use collab_folder::{Folder, FolderData, Workspace};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::entities::{PublishInfoResponse, PublishViewPayload};
|
||||
use lib_infra::future::FutureResult;
|
||||
|
||||
/// [FolderCloudService] represents the cloud service for folder.
|
||||
@ -44,6 +45,24 @@ pub trait FolderCloudService: Send + Sync + 'static {
|
||||
) -> FutureResult<(), Error>;
|
||||
|
||||
fn service_name(&self) -> String;
|
||||
|
||||
fn publish_view(
|
||||
&self,
|
||||
workspace_id: &str,
|
||||
payload: Vec<PublishViewPayload>,
|
||||
) -> 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)]
|
||||
|
@ -1,4 +1,6 @@
|
||||
use crate::folder_builder::ParentChildViews;
|
||||
use collab_folder::{ViewIcon, ViewLayout};
|
||||
use serde::Serialize;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub enum ImportData {
|
||||
@ -39,3 +41,46 @@ pub struct SearchData {
|
||||
/// The data that is stored in the search index row.
|
||||
pub data: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Clone, Debug, Eq, PartialEq)]
|
||||
pub struct PublishViewInfo {
|
||||
pub view_id: String,
|
||||
pub name: String,
|
||||
pub icon: Option<ViewIcon>,
|
||||
pub layout: ViewLayout,
|
||||
pub extra: Option<String>,
|
||||
pub created_by: Option<i64>,
|
||||
pub last_edited_by: Option<i64>,
|
||||
pub last_edited_time: i64,
|
||||
pub created_at: i64,
|
||||
pub child_views: Option<Vec<PublishViewInfo>>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Clone, Debug, Eq, PartialEq)]
|
||||
pub struct PublishViewMetaData {
|
||||
pub view: PublishViewInfo,
|
||||
pub child_views: Vec<PublishViewInfo>,
|
||||
pub ancestor_views: Vec<PublishViewInfo>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct PublishViewMeta {
|
||||
pub metadata: PublishViewMetaData,
|
||||
pub view_id: String,
|
||||
pub publish_name: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct PublishViewPayload {
|
||||
pub meta: PublishViewMeta,
|
||||
/// The doc_state of the encoded collab.
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct PublishInfoResponse {
|
||||
pub view_id: String,
|
||||
/// one part of publish url: /{namespace}/{publish_name}
|
||||
pub publish_name: String,
|
||||
pub namespace: Option<String>,
|
||||
}
|
||||
|
Reference in New Issue
Block a user