chore: add file size (#1015)

This commit is contained in:
Nathan.fooo 2024-11-22 16:31:50 +08:00 committed by GitHub
parent 3a0b210d48
commit 0ec12c5f2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 0 deletions

View File

@ -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 {

View File

@ -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,

View File

@ -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

View File

@ -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