feat(mongo): add GridFS manager for MongoDB

* feat(mongo): browse GridFS buckets and files

Refs #2342

* feat(mongo): add GridFS manager for MongoDB

* chore(i18n): autofill new translations

---------

Co-authored-by: dbx-i18n-bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: t8y2 <1156263951@qq.com>
This commit is contained in:
authored and GitHub committed 2026-07-03 18:34:00 +08:00
1 parent a8abb1c478
commit f826cb5d38
35 files changed
+1959 -39

No files matched your search

+87
View File
@@ -129,3 +129,90 @@ pub async fn document_delete_document(
)
.await
}
#[tauri::command]
pub async fn document_list_gridfs_buckets(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
) -> Result<Vec<dbx_core::document_ops::MongoGridFsBucketInfo>, String> {
dbx_core::document_ops::list_gridfs_buckets_core(&state, &connection_id, &database).await
}
#[tauri::command]
pub async fn document_create_gridfs_bucket(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
bucket: String,
) -> Result<(), String> {
ensure_connection_writable(&state, &connection_id, "Create GridFS bucket").await?;
dbx_core::document_ops::create_gridfs_bucket_core(&state, &connection_id, &database, &bucket).await
}
#[tauri::command]
pub async fn document_delete_gridfs_bucket(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
bucket: String,
) -> Result<(), String> {
ensure_connection_writable(&state, &connection_id, "Delete GridFS bucket").await?;
dbx_core::document_ops::delete_gridfs_bucket_core(&state, &connection_id, &database, &bucket).await
}
#[tauri::command]
pub async fn document_list_gridfs_files(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
bucket: String,
) -> Result<Vec<dbx_core::document_ops::MongoGridFsFileInfo>, String> {
dbx_core::document_ops::list_gridfs_files_core(&state, &connection_id, &database, &bucket).await
}
#[tauri::command]
pub async fn document_download_gridfs_file(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
bucket: String,
file_id: String,
) -> Result<Vec<u8>, String> {
dbx_core::document_ops::download_gridfs_file_core(&state, &connection_id, &database, &bucket, &file_id).await
}
#[tauri::command]
pub async fn document_upload_gridfs_file(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
bucket: String,
file_name: String,
data: Vec<u8>,
content_type: Option<String>,
) -> Result<String, String> {
ensure_connection_writable(&state, &connection_id, "Upload GridFS file").await?;
dbx_core::document_ops::upload_gridfs_file_core(
&state,
&connection_id,
&database,
&bucket,
&file_name,
&data,
content_type.as_deref(),
)
.await
}
#[tauri::command]
pub async fn document_delete_gridfs_file(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
bucket: String,
file_id: String,
) -> Result<(), String> {
ensure_connection_writable(&state, &connection_id, "Delete GridFS file").await?;
dbx_core::document_ops::delete_gridfs_file_core(&state, &connection_id, &database, &bucket, &file_id).await
}