2024-12-19 14:13:53 +08:00
|
|
|
use collab::entity::EncodedCollab;
|
|
|
|
use collab_entity::CollabType;
|
2024-12-13 13:04:17 +08:00
|
|
|
use collab_folder::ViewLayout;
|
2024-12-20 00:15:01 +08:00
|
|
|
use flowy_error::FlowyResult;
|
2024-12-08 18:25:25 +08:00
|
|
|
use lib_infra::async_trait::async_trait;
|
|
|
|
|
2024-12-19 14:13:53 +08:00
|
|
|
pub struct QueryCollab {
|
|
|
|
pub collab_type: CollabType,
|
|
|
|
pub encoded_collab: EncodedCollab,
|
|
|
|
}
|
|
|
|
|
2024-12-20 00:15:01 +08:00
|
|
|
pub trait FolderService: FolderQueryService + FolderViewEdit {}
|
|
|
|
|
2024-12-08 18:25:25 +08:00
|
|
|
#[async_trait]
|
|
|
|
pub trait FolderQueryService: Send + Sync + 'static {
|
2024-12-22 14:46:54 +08:00
|
|
|
/// gets the parent view and all of the ids of its children views matching
|
|
|
|
/// the provided view layout, given that the parent view is not a space
|
|
|
|
async fn get_surrounding_view_ids_with_view_layout(
|
2024-12-13 13:04:17 +08:00
|
|
|
&self,
|
|
|
|
parent_view_id: &str,
|
|
|
|
view_layout: ViewLayout,
|
|
|
|
) -> Vec<String>;
|
2024-12-19 14:13:53 +08:00
|
|
|
|
2024-12-20 00:15:01 +08:00
|
|
|
async fn get_collab(&self, object_id: &str, collab_type: CollabType) -> Option<QueryCollab>;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
pub trait FolderViewEdit: Send + Sync + 'static {
|
|
|
|
async fn set_view_title_if_empty(&self, view_id: &str, title: &str) -> FlowyResult<()>;
|
2024-12-08 18:25:25 +08:00
|
|
|
}
|