diff --git a/libs/database-entity/src/file_dto.rs b/libs/database-entity/src/file_dto.rs index a87076c87..f5bcce636 100644 --- a/libs/database-entity/src/file_dto.rs +++ b/libs/database-entity/src/file_dto.rs @@ -6,6 +6,8 @@ pub struct CreateUploadRequest { pub file_id: String, pub parent_dir: String, pub content_type: String, + #[serde(default)] + pub file_size: Option, } impl Display for CreateUploadRequest { diff --git a/services/appflowy-worker/src/import_worker/worker.rs b/services/appflowy-worker/src/import_worker/worker.rs index 03df19e1e..15baf5d54 100644 --- a/services/appflowy-worker/src/import_worker/worker.rs +++ b/services/appflowy-worker/src/import_worker/worker.rs @@ -70,6 +70,7 @@ const GROUP_NAME: &str = "import_task_group"; const CONSUMER_NAME: &str = "appflowy_worker"; const MAXIMUM_CONTENT_LENGTH: &str = "3221225472"; +#[allow(clippy::too_many_arguments)] pub async fn run_import_worker( pg_pool: PgPool, mut redis_client: ConnectionManager, diff --git a/tests/file_test/delete_dir_test.rs b/tests/file_test/delete_dir_test.rs index 13218258d..d54251448 100644 --- a/tests/file_test/delete_dir_test.rs +++ b/tests/file_test/delete_dir_test.rs @@ -40,6 +40,7 @@ async fn delete_workspace_sub_folder_resource_test() { file_id: file_id.clone(), parent_dir: parent_dir.clone(), content_type: mime.to_string(), + file_size: Some(text.len() as u64), }, ) .await diff --git a/tests/file_test/multiple_part_test.rs b/tests/file_test/multiple_part_test.rs index 4898b787d..3926d9ec7 100644 --- a/tests/file_test/multiple_part_test.rs +++ b/tests/file_test/multiple_part_test.rs @@ -28,6 +28,7 @@ async fn multiple_part_put_and_get_test() { file_id: file_id.clone(), parent_dir: parent_dir.clone(), content_type: mime.to_string(), + file_size: Some(text.len() as u64), }, ) .await @@ -95,6 +96,7 @@ async fn single_part_put_and_get_test() { file_id: file_id.clone(), parent_dir: workspace_id.clone(), content_type: mime.to_string(), + file_size: Some(text.len() as u64), }, ) .await @@ -158,6 +160,7 @@ async fn empty_part_upload_test() { file_id: file_id.clone(), parent_dir: workspace_id.clone(), content_type: mime.to_string(), + file_size: Some(0), }, ) .await @@ -213,6 +216,7 @@ async fn perform_upload_test( file_id: file_id.clone(), parent_dir: parent_dir.clone(), content_type: "text".to_string(), + file_size: Some(file_size as u64), }; let key = BlobPathV1 { @@ -312,11 +316,13 @@ async fn invalid_test() { file_id: "".to_string(), parent_dir: parent_dir.clone(), content_type: mime.to_string(), + file_size: Some(0), }, CreateUploadRequest { file_id: file_id.clone(), parent_dir: "".to_string(), content_type: mime.to_string(), + file_size: Some(0), }, ] { let err = c1.create_upload(&workspace_id, request).await.unwrap_err(); @@ -378,6 +384,7 @@ async fn multiple_level_dir_upload_file_test() { file_id: file_id.clone(), parent_dir: parent_dir.clone(), content_type: mime.to_string(), + file_size: Some(text.len() as u64), }, ) .await