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