Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add file size #1015

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading