feat(breadcrumb): build breadcrumb in 1 API call
add /api/folders/{id}/ancestors
this API to iterate parent up to the drive root or the shared folder
this will help UI to build the breadcrumb in 1 API call
and to identify the root element (is it a drive users has access to or
a shared folder ?)
ui: now only 1 API call is now required to build the breadcrumb
This commit is contained in:
@@ -82,7 +82,7 @@ use crate::interfaces::api::handlers::file_handler::{
|
||||
list_files_query, move_file_simple, rename_file, upload_file_with_thumbnails, upload_thumbnail,
|
||||
};
|
||||
use crate::interfaces::api::handlers::folder_handler::{
|
||||
create_folder, delete_folder_with_trash, download_folder_zip, get_folder,
|
||||
create_folder, delete_folder_with_trash, download_folder_zip, get_folder, get_folder_ancestors,
|
||||
list_folder_resources, list_root_folders, move_folder, rename_folder,
|
||||
};
|
||||
use crate::interfaces::api::handlers::i18n_handler::{
|
||||
@@ -218,6 +218,11 @@ pub fn create_api_routes(app_state: &Arc<AppState>) -> Router<Arc<AppState>> {
|
||||
let folders_crud_router = Router::new()
|
||||
.route("/", post(create_folder))
|
||||
.route("/{id}", get(get_folder))
|
||||
// Ancestor chain for the shared breadcrumb component — one
|
||||
// round-trip vs the pre-2026-07-26 per-segment `getFolder` walk
|
||||
// on the /files client. Returns caller-visible parents (walk
|
||||
// stops at share/drive-membership boundary) + access_source.
|
||||
.route("/{id}/ancestors", get(get_folder_ancestors))
|
||||
.route("/{id}/rename", put(rename_folder))
|
||||
.route("/{id}/move", put(move_folder))
|
||||
.with_state(app_state.clone());
|
||||
|
||||
Reference in New Issue
Block a user