mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor: add PB suffix to flowy-editor crate's structs
This commit is contained in:
@ -3,7 +3,7 @@ use crate::{
|
||||
request::{HttpRequestBuilder, ResponseMiddleware},
|
||||
};
|
||||
use flowy_error::FlowyError;
|
||||
use flowy_sync::entities::text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockId, TextBlockInfo};
|
||||
use flowy_sync::entities::text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockIdPB, TextBlockInfoPB};
|
||||
use flowy_text_block::BlockCloudService;
|
||||
use http_flowy::response::FlowyResponse;
|
||||
use lazy_static::lazy_static;
|
||||
@ -27,7 +27,7 @@ impl BlockCloudService for BlockHttpCloudService {
|
||||
FutureResult::new(async move { create_document_request(&token, params, &url).await })
|
||||
}
|
||||
|
||||
fn read_block(&self, token: &str, params: TextBlockId) -> FutureResult<Option<TextBlockInfo>, FlowyError> {
|
||||
fn read_block(&self, token: &str, params: TextBlockIdPB) -> FutureResult<Option<TextBlockInfoPB>, FlowyError> {
|
||||
let token = token.to_owned();
|
||||
let url = self.config.doc_url();
|
||||
FutureResult::new(async move { read_document_request(&token, params, &url).await })
|
||||
@ -52,9 +52,9 @@ pub async fn create_document_request(token: &str, params: CreateTextBlockParams,
|
||||
|
||||
pub async fn read_document_request(
|
||||
token: &str,
|
||||
params: TextBlockId,
|
||||
params: TextBlockIdPB,
|
||||
url: &str,
|
||||
) -> Result<Option<TextBlockInfo>, FlowyError> {
|
||||
) -> Result<Option<TextBlockInfoPB>, FlowyError> {
|
||||
let doc = request_builder()
|
||||
.get(&url.to_owned())
|
||||
.header(HEADER_TOKEN, token)
|
||||
|
@ -1,5 +1,5 @@
|
||||
use flowy_sync::{
|
||||
entities::{folder::FolderInfo, text_block::TextBlockInfo},
|
||||
entities::{folder::FolderInfo, text_block::TextBlockInfoPB},
|
||||
errors::CollaborateError,
|
||||
protobuf::{RepeatedRevision as RepeatedRevisionPB, Revision as RevisionPB},
|
||||
server_document::*,
|
||||
@ -111,7 +111,7 @@ impl FolderCloudPersistence for LocalTextBlockCloudPersistence {
|
||||
}
|
||||
|
||||
impl TextBlockCloudPersistence for LocalTextBlockCloudPersistence {
|
||||
fn read_text_block(&self, doc_id: &str) -> BoxResultFuture<TextBlockInfo, CollaborateError> {
|
||||
fn read_text_block(&self, doc_id: &str) -> BoxResultFuture<TextBlockInfoPB, CollaborateError> {
|
||||
let storage = self.storage.clone();
|
||||
let doc_id = doc_id.to_owned();
|
||||
Box::pin(async move {
|
||||
@ -127,7 +127,7 @@ impl TextBlockCloudPersistence for LocalTextBlockCloudPersistence {
|
||||
&self,
|
||||
doc_id: &str,
|
||||
repeated_revision: RepeatedRevisionPB,
|
||||
) -> BoxResultFuture<Option<TextBlockInfo>, CollaborateError> {
|
||||
) -> BoxResultFuture<Option<TextBlockInfoPB>, CollaborateError> {
|
||||
let doc_id = doc_id.to_owned();
|
||||
let storage = self.storage.clone();
|
||||
Box::pin(async move {
|
||||
|
@ -6,7 +6,7 @@ use flowy_folder::event_map::FolderCouldServiceV1;
|
||||
use flowy_sync::{
|
||||
client_document::default::initial_quill_delta_string,
|
||||
entities::{
|
||||
text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockId, TextBlockInfo},
|
||||
text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockIdPB, TextBlockInfoPB},
|
||||
ws_data::{ClientRevisionWSData, ClientRevisionWSDataType},
|
||||
},
|
||||
errors::CollaborateError,
|
||||
@ -419,8 +419,8 @@ impl BlockCloudService for LocalServer {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
|
||||
fn read_block(&self, _token: &str, params: TextBlockId) -> FutureResult<Option<TextBlockInfo>, FlowyError> {
|
||||
let doc = TextBlockInfo {
|
||||
fn read_block(&self, _token: &str, params: TextBlockIdPB) -> FutureResult<Option<TextBlockInfoPB>, FlowyError> {
|
||||
let doc = TextBlockInfoPB {
|
||||
block_id: params.value,
|
||||
text: initial_quill_delta_string(),
|
||||
rev_id: 0,
|
||||
|
Reference in New Issue
Block a user