feat: add grid struct

This commit is contained in:
appflowy
2022-03-02 21:12:21 +08:00
parent 5549cff177
commit 4187e99433
26 changed files with 3233 additions and 158 deletions

View File

@ -2,8 +2,8 @@ use crate::{
configuration::*,
request::{HttpRequestBuilder, ResponseMiddleware},
};
use flowy_block::BlockCloudService;
use flowy_collaboration::entities::document_info::{BlockId, BlockInfo, CreateBlockParams, ResetDocumentParams};
use flowy_collaboration::entities::document_info::{BlockId, BlockInfo, CreateBlockParams, ResetBlockParams};
use flowy_document::BlockCloudService;
use flowy_error::FlowyError;
use http_flowy::response::FlowyResponse;
use lazy_static::lazy_static;
@ -33,7 +33,7 @@ impl BlockCloudService for BlockHttpCloudService {
FutureResult::new(async move { read_document_request(&token, params, &url).await })
}
fn update_block(&self, token: &str, params: ResetDocumentParams) -> FutureResult<(), FlowyError> {
fn update_block(&self, token: &str, params: ResetBlockParams) -> FutureResult<(), FlowyError> {
let token = token.to_owned();
let url = self.config.doc_url();
FutureResult::new(async move { reset_doc_request(&token, params, &url).await })
@ -61,7 +61,7 @@ pub async fn read_document_request(token: &str, params: BlockId, url: &str) -> R
Ok(doc)
}
pub async fn reset_doc_request(token: &str, params: ResetDocumentParams, url: &str) -> Result<(), FlowyError> {
pub async fn reset_doc_request(token: &str, params: ResetBlockParams, url: &str) -> Result<(), FlowyError> {
let _ = request_builder()
.patch(&url.to_owned())
.header(HEADER_TOKEN, token)

View File

@ -4,7 +4,7 @@ use bytes::Bytes;
use flowy_collaboration::{
client_document::default::initial_delta_string,
entities::{
document_info::{BlockId, BlockInfo, CreateBlockParams, ResetDocumentParams},
document_info::{BlockId, BlockInfo, CreateBlockParams, ResetBlockParams},
ws_data::{ClientRevisionWSData, ClientRevisionWSDataType},
},
errors::CollaborateError,
@ -416,7 +416,7 @@ impl BlockCloudService for LocalServer {
fn read_block(&self, _token: &str, params: BlockId) -> FutureResult<Option<BlockInfo>, FlowyError> {
let doc = BlockInfo {
doc_id: params.value,
block_id: params.value,
text: initial_delta_string(),
rev_id: 0,
base_rev_id: 0,
@ -424,7 +424,7 @@ impl BlockCloudService for LocalServer {
FutureResult::new(async { Ok(Some(doc)) })
}
fn update_block(&self, _token: &str, _params: ResetDocumentParams) -> FutureResult<(), FlowyError> {
fn update_block(&self, _token: &str, _params: ResetBlockParams) -> FutureResult<(), FlowyError> {
FutureResult::new(async { Ok(()) })
}
}