2023-05-21 18:53:59 +08:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2023-08-12 17:36:31 +08:00
|
|
|
use collab_plugins::cloud_storage::{CollabObject, RemoteCollabStorage};
|
2023-07-05 20:57:09 +08:00
|
|
|
|
2023-07-29 09:46:24 +08:00
|
|
|
use flowy_database_deps::cloud::DatabaseCloudService;
|
|
|
|
use flowy_document_deps::cloud::DocumentCloudService;
|
|
|
|
use flowy_folder_deps::cloud::FolderCloudService;
|
2023-08-24 14:00:34 +08:00
|
|
|
use flowy_user_deps::cloud::UserCloudService;
|
2023-05-21 18:53:59 +08:00
|
|
|
|
2023-08-31 16:40:40 +08:00
|
|
|
use crate::af_cloud::configuration::AFCloudConfiguration;
|
|
|
|
use crate::af_cloud::impls::{
|
|
|
|
AFCloudDatabaseCloudServiceImpl, AFCloudDocumentCloudServiceImpl, AFCloudFolderCloudServiceImpl,
|
|
|
|
AFCloudUserAuthServiceImpl,
|
2023-05-23 23:55:21 +08:00
|
|
|
};
|
2023-05-21 18:53:59 +08:00
|
|
|
use crate::AppFlowyServer;
|
|
|
|
|
2023-08-31 16:40:40 +08:00
|
|
|
pub struct AFCloudServer {
|
|
|
|
pub(crate) config: AFCloudConfiguration,
|
2023-05-21 18:53:59 +08:00
|
|
|
}
|
|
|
|
|
2023-08-31 16:40:40 +08:00
|
|
|
impl AFCloudServer {
|
|
|
|
pub fn new(config: AFCloudConfiguration) -> Self {
|
2023-05-21 18:53:59 +08:00
|
|
|
Self { config }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-31 16:40:40 +08:00
|
|
|
impl AppFlowyServer for AFCloudServer {
|
2023-08-24 14:00:34 +08:00
|
|
|
fn user_service(&self) -> Arc<dyn UserCloudService> {
|
2023-08-31 16:40:40 +08:00
|
|
|
Arc::new(AFCloudUserAuthServiceImpl::new(self.config.clone()))
|
2023-05-21 18:53:59 +08:00
|
|
|
}
|
2023-05-23 23:55:21 +08:00
|
|
|
|
|
|
|
fn folder_service(&self) -> Arc<dyn FolderCloudService> {
|
2023-08-31 16:40:40 +08:00
|
|
|
Arc::new(AFCloudFolderCloudServiceImpl())
|
2023-05-23 23:55:21 +08:00
|
|
|
}
|
2023-07-05 20:57:09 +08:00
|
|
|
|
|
|
|
fn database_service(&self) -> Arc<dyn DatabaseCloudService> {
|
2023-08-31 16:40:40 +08:00
|
|
|
Arc::new(AFCloudDatabaseCloudServiceImpl())
|
2023-07-05 20:57:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn document_service(&self) -> Arc<dyn DocumentCloudService> {
|
2023-08-31 16:40:40 +08:00
|
|
|
Arc::new(AFCloudDocumentCloudServiceImpl())
|
2023-07-05 20:57:09 +08:00
|
|
|
}
|
|
|
|
|
2023-08-12 17:36:31 +08:00
|
|
|
fn collab_storage(&self, _collab_object: &CollabObject) -> Option<Arc<dyn RemoteCollabStorage>> {
|
2023-07-05 20:57:09 +08:00
|
|
|
None
|
|
|
|
}
|
2023-05-21 18:53:59 +08:00
|
|
|
}
|