style: apply cargo fmt to entire codebase

Standardize code formatting across all 173 Rust source files
using rustfmt. No functional changes - purely cosmetic.

This establishes a consistent code style baseline for the
project going forward.
This commit is contained in:
Dionisio
2026-02-14 01:29:34 +01:00
parent 67137a3ef2
commit 4c98c5a657
173 changed files with 23368 additions and 17590 deletions
+84 -63
View File
@@ -1,16 +1,16 @@
use std::sync::Arc;
use axum::{
extract::{State, Json},
response::IntoResponse,
extract::{Json, State},
http::StatusCode,
response::IntoResponse,
};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use crate::application::services::batch_operations::{
BatchOperationService, BatchResult, BatchStats
};
use crate::application::dtos::file_dto::FileDto;
use crate::application::dtos::folder_dto::FolderDto;
use crate::application::services::batch_operations::{
BatchOperationService, BatchResult, BatchStats,
};
use crate::interfaces::api::handlers::ApiResult;
/// Shared state for the batch handler
@@ -111,11 +111,13 @@ where
{
fn from(result: BatchResult<T>) -> Self {
let successful = result.successful.into_iter().map(U::from).collect();
let failed = result.failed.into_iter()
let failed = result
.failed
.into_iter()
.map(|(id, error)| FailedOperation { id, error })
.collect();
Self {
successful,
failed,
@@ -135,19 +137,21 @@ pub async fn move_files_batch(
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": "No file IDs provided"
}))
).into_response());
})),
)
.into_response());
}
// Execute batch operation
let result = state.batch_service
let result = state
.batch_service
.move_files(request.file_ids, request.target_folder_id)
.await
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
// Convert result to DTO
let response: BatchOperationResponse<FileDto> = result.into();
// Determine status code based on results
let status_code = if response.stats.failed > 0 {
if response.stats.successful > 0 {
@@ -158,7 +162,7 @@ pub async fn move_files_batch(
} else {
StatusCode::OK // All successful
};
Ok((status_code, Json(response)).into_response())
}
@@ -173,19 +177,21 @@ pub async fn copy_files_batch(
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": "No file IDs provided"
}))
).into_response());
})),
)
.into_response());
}
// Execute batch operation
let result = state.batch_service
let result = state
.batch_service
.copy_files(request.file_ids, request.target_folder_id)
.await
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
// Convert result to DTO
let response: BatchOperationResponse<FileDto> = result.into();
// Determine status code based on results
let status_code = if response.stats.failed > 0 {
if response.stats.successful > 0 {
@@ -196,7 +202,7 @@ pub async fn copy_files_batch(
} else {
StatusCode::OK // All successful
};
Ok((status_code, Json(response)).into_response())
}
@@ -211,25 +217,29 @@ pub async fn delete_files_batch(
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": "No file IDs provided"
}))
).into_response());
})),
)
.into_response());
}
// Execute batch operation
let result = state.batch_service
let result = state
.batch_service
.delete_files(request.file_ids)
.await
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
// Create custom response for string IDs
let response = BatchOperationResponse {
successful: result.successful,
failed: result.failed.into_iter()
failed: result
.failed
.into_iter()
.map(|(id, error)| FailedOperation { id, error })
.collect(),
stats: result.stats.into(),
};
// Determine status code based on results
let status_code = if response.stats.failed > 0 {
if response.stats.successful > 0 {
@@ -240,7 +250,7 @@ pub async fn delete_files_batch(
} else {
StatusCode::OK // All successful
};
Ok((status_code, Json(response)).into_response())
}
@@ -255,25 +265,29 @@ pub async fn delete_folders_batch(
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": "No folder IDs provided"
}))
).into_response());
})),
)
.into_response());
}
// Execute batch operation
let result = state.batch_service
let result = state
.batch_service
.delete_folders(request.folder_ids, request.recursive)
.await
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
// Create custom response for string IDs
let response = BatchOperationResponse {
successful: result.successful,
failed: result.failed.into_iter()
failed: result
.failed
.into_iter()
.map(|(id, error)| FailedOperation { id, error })
.collect(),
stats: result.stats.into(),
};
// Determine status code based on results
let status_code = if response.stats.failed > 0 {
if response.stats.successful > 0 {
@@ -284,7 +298,7 @@ pub async fn delete_folders_batch(
} else {
StatusCode::OK // All successful
};
Ok((status_code, Json(response)).into_response())
}
@@ -299,25 +313,28 @@ pub async fn create_folders_batch(
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": "No folders provided"
}))
).into_response());
})),
)
.into_response());
}
// Transform the format for the service
let folders = request.folders
let folders = request
.folders
.into_iter()
.map(|detail| (detail.name, detail.parent_id))
.collect();
// Execute batch operation
let result = state.batch_service
let result = state
.batch_service
.create_folders(folders)
.await
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
// Convert result to DTO
let response: BatchOperationResponse<FolderDto> = result.into();
// Determine status code based on results
let status_code = if response.stats.failed > 0 {
if response.stats.successful > 0 {
@@ -328,7 +345,7 @@ pub async fn create_folders_batch(
} else {
StatusCode::CREATED // All successful
};
Ok((status_code, Json(response)).into_response())
}
@@ -343,19 +360,21 @@ pub async fn get_files_batch(
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": "No file IDs provided"
}))
).into_response());
})),
)
.into_response());
}
// Execute batch operation
let result = state.batch_service
let result = state
.batch_service
.get_multiple_files(request.file_ids)
.await
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
// Convert result to DTO
let response: BatchOperationResponse<FileDto> = result.into();
// Determine status code based on results
let status_code = if response.stats.failed > 0 {
if response.stats.successful > 0 {
@@ -366,7 +385,7 @@ pub async fn get_files_batch(
} else {
StatusCode::OK // All successful
};
Ok((status_code, Json(response)).into_response())
}
@@ -381,19 +400,21 @@ pub async fn get_folders_batch(
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": "No folder IDs provided"
}))
).into_response());
})),
)
.into_response());
}
// Execute batch operation
let result = state.batch_service
let result = state
.batch_service
.get_multiple_folders(request.folder_ids)
.await
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
// Convert result to DTO
let response: BatchOperationResponse<FolderDto> = result.into();
// Determine status code based on results
let status_code = if response.stats.failed > 0 {
if response.stats.successful > 0 {
@@ -404,6 +425,6 @@ pub async fn get_folders_batch(
} else {
StatusCode::OK // All successful
};
Ok((status_code, Json(response)).into_response())
}
}