refactor(api): remove 5 deprecated list endpoints superseded by /resources

The normalized cursor-paginated /resources API is live and the bundled
frontend already uses it for favorites, recent, trash and grants. These five
deprecated old-format endpoints had no remaining frontend or protocol
consumers (the Nextcloud handlers call the service layer directly, not these
HTTP routes), so remove them for a uniform API and less duplicate listing
logic:

- GET /api/folders/{id}/contents          → use /api/folders/{id}/resources
- GET /api/folders/{id}/contents/paginated → use /api/folders/{id}/resources
- GET /api/favorites                       → use /api/favorites/resources
- GET /api/recent                          → use /api/recent/resources
- GET /api/trash                           → use /api/trash/resources

Removes the HTTP handlers, their routes, OpenAPI path registrations, and the
now-dead list_folder_contents{,_paginated}_impl helpers + unused imports. The
underlying service methods (favorites_service.get_favorites,
trash_service.get_trash_items, etc.) are KEPT — the Nextcloud OCS/trashbin
handlers depend on them.

Deliberately NOT removed: GET /api/folders/{id}/listing. It is still the Files
view's primary data path and offers ETag/304 conditional caching plus
one-shot favorite/share badge sets that /resources does not yet provide;
migrating it needs a separate parity pass on /resources first.

Updates the OpenAPI structure test and the two docs that referenced the
removed paths. `cargo clippy -D warnings` clean; 443 lib tests pass; OpenAPI
regenerates with the 5 paths gone and the /resources replacements present.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
DioCrafts
2026-06-19 23:46:58 +02:00
parent 3f887089ae
commit 2b5339b73e
8 changed files with 21 additions and 266 deletions
+10 -10
View File
@@ -98,9 +98,7 @@ use crate::interfaces::api::handlers::file_handler::MoveFilePayload;
handlers::folder_handler::create_folder,
handlers::folder_handler::get_folder,
handlers::folder_handler::list_root_folders,
handlers::folder_handler::list_folder_contents,
handlers::folder_handler::list_root_folders_paginated,
handlers::folder_handler::list_folder_contents_paginated,
handlers::folder_handler::list_folder_resources,
handlers::folder_handler::list_folder_listing,
handlers::folder_handler::rename_folder,
@@ -130,7 +128,6 @@ use crate::interfaces::api::handlers::file_handler::MoveFilePayload;
handlers::dedup_handler::get_blob,
handlers::dedup_handler::recalculate_stats,
// Trash handlers (free functions)
handlers::trash_handler::get_trash_items,
handlers::trash_handler::get_trash_resources,
handlers::trash_handler::move_file_to_trash,
handlers::trash_handler::move_folder_to_trash,
@@ -152,13 +149,11 @@ use crate::interfaces::api::handlers::file_handler::MoveFilePayload;
handlers::share_handler::download_share_zip_root,
handlers::share_handler::download_share_zip_subfolder,
// Favorites handlers (free functions)
handlers::favorites_handler::get_favorites,
handlers::favorites_handler::list_favorites_resources,
handlers::favorites_handler::add_favorite,
handlers::favorites_handler::remove_favorite,
handlers::favorites_handler::batch_add_favorites,
// Recent handlers (free functions)
handlers::recent_handler::get_recent_items,
handlers::recent_handler::list_recent_resources,
handlers::recent_handler::record_item_access,
handlers::recent_handler::remove_from_recent,
@@ -433,18 +428,23 @@ mod tests {
"expected at least 10 paths, got {}",
paths.paths.len()
);
assert!(paths.paths.contains_key("/api/trash"), "missing /api/trash");
// The old grouped list endpoints (/api/trash, /api/favorites, /api/recent)
// were removed in favour of the normalized cursor-paginated /resources API.
assert!(
paths.paths.contains_key("/api/trash/resources"),
"missing /api/trash/resources"
);
assert!(
paths.paths.contains_key("/api/shares"),
"missing /api/shares"
);
assert!(
paths.paths.contains_key("/api/favorites"),
"missing /api/favorites"
paths.paths.contains_key("/api/favorites/resources"),
"missing /api/favorites/resources"
);
assert!(
paths.paths.contains_key("/api/recent"),
"missing /api/recent"
paths.paths.contains_key("/api/recent/resources"),
"missing /api/recent/resources"
);
let schemas = &spec