diff --git a/src/application/services/storage_usage_service.rs b/src/application/services/storage_usage_service.rs index 487f2302..2d46f787 100644 --- a/src/application/services/storage_usage_service.rs +++ b/src/application/services/storage_usage_service.rs @@ -207,13 +207,14 @@ impl StorageUsageService { drive_id: Uuid, additional_bytes: u64, ) -> Result<(), DomainError> { - let row: Option<(i64, Option)> = sqlx::query_as( - "SELECT used_bytes, quota_bytes FROM storage.drives WHERE id = $1", - ) - .bind(drive_id) - .fetch_optional(self.pool.as_ref()) - .await - .map_err(|e| DomainError::internal_error("StorageUsage", format!("drive quota lookup: {e}")))?; + let row: Option<(i64, Option)> = + sqlx::query_as("SELECT used_bytes, quota_bytes FROM storage.drives WHERE id = $1") + .bind(drive_id) + .fetch_optional(self.pool.as_ref()) + .await + .map_err(|e| { + DomainError::internal_error("StorageUsage", format!("drive quota lookup: {e}")) + })?; let Some((used, quota)) = row else { // Anti-enum at the upload edge would normally map to 404, @@ -468,10 +469,7 @@ impl StorageUsagePort for StorageUsageService { .await .map_err(|e| { error!("Drive storage-usage reconciliation sweep failed: {}", e); - DomainError::internal_error( - "StorageUsage", - format!("drive reconciliation sweep: {e}"), - ) + DomainError::internal_error("StorageUsage", format!("drive reconciliation sweep: {e}")) })?; info!( diff --git a/src/application/services/trash_service.rs b/src/application/services/trash_service.rs index 56988fbb..48f6f139 100644 --- a/src/application/services/trash_service.rs +++ b/src/application/services/trash_service.rs @@ -846,7 +846,11 @@ impl TrashService { } } - info!("Trash cleared across {} drive(s) for user {}", drive_ids.len(), user_id); + info!( + "Trash cleared across {} drive(s) for user {}", + drive_ids.len(), + user_id + ); Ok(()) } } diff --git a/src/infrastructure/repositories/pg/drive_pg_repository.rs b/src/infrastructure/repositories/pg/drive_pg_repository.rs index e4fb398e..ddf0615b 100644 --- a/src/infrastructure/repositories/pg/drive_pg_repository.rs +++ b/src/infrastructure/repositories/pg/drive_pg_repository.rs @@ -355,14 +355,13 @@ impl DriveRepository for DrivePgRepository { .await .map_err(|e| Self::map_sqlx_err("delete_atomic.grants", e))?; - let root: (Uuid,) = sqlx::query_as( - "SELECT root_folder_id FROM storage.drives WHERE id = $1", - ) - .bind(drive_id) - .fetch_optional(&mut *tx) - .await - .map_err(|e| Self::map_sqlx_err("delete_atomic.lookup_root", e))? - .ok_or_else(|| DriveRepositoryError::NotFound(drive_id.to_string()))?; + let root: (Uuid,) = + sqlx::query_as("SELECT root_folder_id FROM storage.drives WHERE id = $1") + .bind(drive_id) + .fetch_optional(&mut *tx) + .await + .map_err(|e| Self::map_sqlx_err("delete_atomic.lookup_root", e))? + .ok_or_else(|| DriveRepositoryError::NotFound(drive_id.to_string()))?; sqlx::query("DELETE FROM storage.drives WHERE id = $1") .bind(drive_id) diff --git a/src/infrastructure/services/dedup_service.rs b/src/infrastructure/services/dedup_service.rs index a0de1aff..15742733 100644 --- a/src/infrastructure/services/dedup_service.rs +++ b/src/infrastructure/services/dedup_service.rs @@ -1912,10 +1912,7 @@ impl DedupService { self.garbage_collect_with_grace(0).await } - async fn garbage_collect_with_grace( - &self, - grace_secs: i64, - ) -> Result<(u64, u64), DomainError> { + async fn garbage_collect_with_grace(&self, grace_secs: i64) -> Result<(u64, u64), DomainError> { const BATCH_SIZE: i64 = 500; let mut total_deleted = 0u64; diff --git a/src/interfaces/api/routes.rs b/src/interfaces/api/routes.rs index a092ec24..05083692 100644 --- a/src/interfaces/api/routes.rs +++ b/src/interfaces/api/routes.rs @@ -425,10 +425,7 @@ pub fn create_api_routes(app_state: &Arc) -> Router> { "/", get(drive_handler::list_drives).post(drive_handler::create_drive), ) - .route( - "/{id}", - axum::routing::delete(drive_handler::delete_drive), - ) + .route("/{id}", axum::routing::delete(drive_handler::delete_drive)) .route( "/{id}/members", get(drive_handler::list_drive_members).post(drive_handler::add_drive_member),