chore(deprecated api): log a warning on serverside if a deprecated route is still used
This commit is contained in:
@@ -6,7 +6,7 @@ use axum::{
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use std::sync::Arc;
|
||||
use tracing::{error, info};
|
||||
use tracing::{error, info, warn};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::application::dtos::display_helpers::{
|
||||
@@ -56,6 +56,7 @@ pub async fn get_favorites(
|
||||
auth_user: AuthUser,
|
||||
) -> impl IntoResponse {
|
||||
let user_id = auth_user.id;
|
||||
warn!("Deprecated endpoint called: GET /api/favorites — use GET /api/favorites/resources instead");
|
||||
|
||||
match favorites_service.get_favorites(user_id).await {
|
||||
Ok(favorites) => {
|
||||
|
||||
@@ -490,6 +490,7 @@ pub async fn list_folder_contents(
|
||||
auth_user: AuthUser,
|
||||
path: Path<String>,
|
||||
) -> axum::response::Response {
|
||||
tracing::warn!("Deprecated endpoint called: GET /api/folders/{{id}}/contents — use GET /api/folders/{{id}}/resources?resource_types=folder instead");
|
||||
FolderHandler::list_folder_contents_impl(state, auth_user, path).await
|
||||
}
|
||||
|
||||
@@ -533,6 +534,7 @@ pub async fn list_folder_contents_paginated(
|
||||
path: Path<String>,
|
||||
pagination: Query<PaginationRequestDto>,
|
||||
) -> axum::response::Response {
|
||||
tracing::warn!("Deprecated endpoint called: GET /api/folders/{{id}}/contents/paginated — use GET /api/folders/{{id}}/resources instead");
|
||||
FolderHandler::list_folder_contents_paginated_impl(state, auth_user, path, pagination).await
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use axum::{
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use std::sync::Arc;
|
||||
use tracing::{error, info};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
use crate::application::dtos::display_helpers::{
|
||||
category_for, format_file_size, icon_class_for, icon_special_class_for,
|
||||
@@ -47,6 +47,7 @@ pub async fn get_recent_items(
|
||||
Query(params): Query<GetRecentParams>,
|
||||
) -> impl IntoResponse {
|
||||
let user_id = auth_user.id;
|
||||
warn!("Deprecated endpoint called: GET /api/recent — use GET /api/recent/resources instead");
|
||||
|
||||
match recent_service.get_recent_items(user_id, params.limit).await {
|
||||
Ok(items) => {
|
||||
|
||||
@@ -338,8 +338,8 @@ pub fn create_api_routes(app_state: &Arc<AppState>) -> Router<Arc<AppState>> {
|
||||
};
|
||||
|
||||
Router::new()
|
||||
.route("/", get(get_favorites)) // deprecated, kept for compat
|
||||
.route("/resources", get(list_favorites_resources)) // new cursor-paginated endpoint
|
||||
.route("/", get(get_favorites)) // deprecated — kept for external compat
|
||||
.route("/resources", get(list_favorites_resources))
|
||||
.route("/batch", post(favorites_handler::batch_add_favorites))
|
||||
.route(
|
||||
"/{item_type}/{item_id}",
|
||||
@@ -360,7 +360,7 @@ pub fn create_api_routes(app_state: &Arc<AppState>) -> Router<Arc<AppState>> {
|
||||
use crate::interfaces::api::handlers::recent_handler;
|
||||
|
||||
Router::new()
|
||||
.route("/", get(recent_handler::get_recent_items))
|
||||
.route("/", get(recent_handler::get_recent_items)) // deprecated — kept for external compat
|
||||
.route("/resources", get(recent_handler::list_recent_resources))
|
||||
.route(
|
||||
"/{item_type}/{item_id}",
|
||||
|
||||
Reference in New Issue
Block a user