Skip to content

Commit

Permalink
chore: add file size
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Nov 22, 2024
1 parent 3a0b210 commit 1e77122
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/database-entity/src/file_dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64>,
}

impl Display for CreateUploadRequest {
Expand Down
1 change: 1 addition & 0 deletions services/appflowy-worker/src/import_worker/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/file_test/delete_dir_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/file_test/multiple_part_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1e77122

Please sign in to comment.