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
+133 -105
View File
@@ -1,6 +1,6 @@
use std::time::Duration;
use std::path::PathBuf;
use std::env;
use std::path::PathBuf;
use std::time::Duration;
/// Cache configuration
#[derive(Debug, Clone)]
@@ -16,9 +16,9 @@ pub struct CacheConfig {
impl Default for CacheConfig {
fn default() -> Self {
Self {
file_ttl_ms: 60_000, // 1 minute
file_ttl_ms: 60_000, // 1 minute
directory_ttl_ms: 120_000, // 2 minutes
max_entries: 10_000, // 10,000 entries
max_entries: 10_000, // 10,000 entries
}
}
}
@@ -100,10 +100,10 @@ pub struct ResourceConfig {
impl Default for ResourceConfig {
fn default() -> Self {
Self {
large_file_threshold_mb: 100, // 100 MB
large_dir_threshold_entries: 1000, // 1000 entries
chunk_size_bytes: 1024 * 1024, // 1 MB
max_in_memory_file_size_mb: 50, // 50 MB
large_file_threshold_mb: 100, // 100 MB
large_dir_threshold_entries: 1000, // 1000 entries
chunk_size_bytes: 1024 * 1024, // 1 MB
max_in_memory_file_size_mb: 50, // 50 MB
}
}
}
@@ -118,7 +118,7 @@ impl ResourceConfig {
pub fn is_large_file(&self, size_bytes: u64) -> bool {
self.bytes_to_mb(size_bytes) >= self.large_file_threshold_mb
}
/// Determines if a file is large enough for parallel processing
pub fn needs_parallel_processing(&self, size_bytes: u64, config: &ConcurrencyConfig) -> bool {
self.bytes_to_mb(size_bytes) >= config.min_size_for_parallel_chunks_mb
@@ -133,27 +133,27 @@ impl ResourceConfig {
pub fn is_large_directory(&self, entry_count: usize) -> bool {
entry_count >= self.large_dir_threshold_entries
}
/// Calculates the number of chunks for parallel processing
pub fn calculate_optimal_chunks(&self, size_bytes: u64, config: &ConcurrencyConfig) -> usize {
// If the file is not large enough, return 1
if !self.needs_parallel_processing(size_bytes, config) {
return 1;
}
// Calculate the number of chunks based on size
let chunk_count = (size_bytes as usize).div_ceil(config.parallel_chunk_size_bytes);
// Limit to the maximum number of parallel chunks
chunk_count.min(config.max_parallel_chunks)
}
/// Calculates the optimal size of each chunk for parallel processing
pub fn calculate_chunk_size(&self, file_size: u64, chunk_count: usize) -> usize {
if chunk_count <= 1 {
return file_size as usize;
}
// Distribute the size evenly among the chunks
(file_size as usize).div_ceil(chunk_count)
}
@@ -183,7 +183,7 @@ impl Default for ConcurrencyConfig {
max_concurrent_dirs: 5,
max_concurrent_io: 20,
max_parallel_chunks: 8,
min_size_for_parallel_chunks_mb: 200, // 200 MB
min_size_for_parallel_chunks_mb: 200, // 200 MB
parallel_chunk_size_bytes: 8 * 1024 * 1024, // 8 MB
}
}
@@ -206,9 +206,9 @@ impl Default for StorageConfig {
fn default() -> Self {
Self {
root_dir: "storage".to_string(),
chunk_size: 1024 * 1024, // 1 MB
chunk_size: 1024 * 1024, // 1 MB
parallel_threshold: 100 * 1024 * 1024, // 100 MB
trash_retention_days: 30, // 30 days
trash_retention_days: 30, // 30 days
}
}
}
@@ -255,9 +255,9 @@ impl Default for AuthConfig {
// to set OXICLOUD_JWT_SECRET in production. The from_env() method
// will validate this and warn/panic if not configured.
jwt_secret: String::new(),
access_token_expiry_secs: 3600, // 1 hour
access_token_expiry_secs: 3600, // 1 hour
refresh_token_expiry_secs: 2592000, // 30 days
hash_memory_cost: 65536, // 64MB
hash_memory_cost: 65536, // 64MB
hash_time_cost: 3,
}
}
@@ -316,20 +316,36 @@ impl OidcConfig {
if let Ok(v) = env::var("OXICLOUD_OIDC_ENABLED") {
cfg.enabled = v.parse::<bool>().unwrap_or(false);
}
if let Ok(v) = env::var("OXICLOUD_OIDC_ISSUER_URL") { cfg.issuer_url = v; }
if let Ok(v) = env::var("OXICLOUD_OIDC_CLIENT_ID") { cfg.client_id = v; }
if let Ok(v) = env::var("OXICLOUD_OIDC_CLIENT_SECRET") { cfg.client_secret = v; }
if let Ok(v) = env::var("OXICLOUD_OIDC_REDIRECT_URI") { cfg.redirect_uri = v; }
if let Ok(v) = env::var("OXICLOUD_OIDC_SCOPES") { cfg.scopes = v; }
if let Ok(v) = env::var("OXICLOUD_OIDC_FRONTEND_URL") { cfg.frontend_url = v; }
if let Ok(v) = env::var("OXICLOUD_OIDC_ISSUER_URL") {
cfg.issuer_url = v;
}
if let Ok(v) = env::var("OXICLOUD_OIDC_CLIENT_ID") {
cfg.client_id = v;
}
if let Ok(v) = env::var("OXICLOUD_OIDC_CLIENT_SECRET") {
cfg.client_secret = v;
}
if let Ok(v) = env::var("OXICLOUD_OIDC_REDIRECT_URI") {
cfg.redirect_uri = v;
}
if let Ok(v) = env::var("OXICLOUD_OIDC_SCOPES") {
cfg.scopes = v;
}
if let Ok(v) = env::var("OXICLOUD_OIDC_FRONTEND_URL") {
cfg.frontend_url = v;
}
if let Ok(v) = env::var("OXICLOUD_OIDC_AUTO_PROVISION") {
cfg.auto_provision = v.parse::<bool>().unwrap_or(true);
}
if let Ok(v) = env::var("OXICLOUD_OIDC_ADMIN_GROUPS") { cfg.admin_groups = v; }
if let Ok(v) = env::var("OXICLOUD_OIDC_ADMIN_GROUPS") {
cfg.admin_groups = v;
}
if let Ok(v) = env::var("OXICLOUD_OIDC_DISABLE_PASSWORD_LOGIN") {
cfg.disable_password_login = v.parse::<bool>().unwrap_or(false);
}
if let Ok(v) = env::var("OXICLOUD_OIDC_PROVIDER_NAME") { cfg.provider_name = v; }
if let Ok(v) = env::var("OXICLOUD_OIDC_PROVIDER_NAME") {
cfg.provider_name = v;
}
cfg
}
}
@@ -347,11 +363,11 @@ pub struct FeaturesConfig {
impl Default for FeaturesConfig {
fn default() -> Self {
Self {
enable_auth: true, // Enable authentication by default
enable_auth: true, // Enable authentication by default
enable_user_storage_quotas: false,
enable_file_sharing: true, // Enable file sharing by default
enable_trash: true, // Enable trash feature
enable_search: true, // Enable search feature
enable_file_sharing: true, // Enable file sharing by default
enable_trash: true, // Enable trash feature
enable_search: true, // Enable search feature
}
}
}
@@ -410,47 +426,50 @@ impl Default for AppConfig {
impl AppConfig {
pub fn from_env() -> Self {
let mut config = Self::default();
// Use environment variables to override default values
if let Ok(storage_path) = env::var("OXICLOUD_STORAGE_PATH") {
config.storage_path = PathBuf::from(storage_path);
}
if let Ok(static_path) = env::var("OXICLOUD_STATIC_PATH") {
config.static_path = PathBuf::from(static_path);
}
if let Ok(server_port) = env::var("OXICLOUD_SERVER_PORT")
&& let Ok(port) = server_port.parse::<u16>() {
config.server_port = port;
}
&& let Ok(port) = server_port.parse::<u16>()
{
config.server_port = port;
}
if let Ok(server_host) = env::var("OXICLOUD_SERVER_HOST") {
config.server_host = server_host;
}
// Database configuration
if let Ok(connection_string) = env::var("OXICLOUD_DB_CONNECTION_STRING") {
config.database.connection_string = connection_string;
}
if let Ok(max_connections) = env::var("OXICLOUD_DB_MAX_CONNECTIONS")
.map(|v| v.parse::<u32>())
&& let Ok(val) = max_connections {
config.database.max_connections = val;
}
if let Ok(min_connections) = env::var("OXICLOUD_DB_MIN_CONNECTIONS")
.map(|v| v.parse::<u32>())
&& let Ok(val) = min_connections {
config.database.min_connections = val;
}
if let Ok(max_connections) =
env::var("OXICLOUD_DB_MAX_CONNECTIONS").map(|v| v.parse::<u32>())
&& let Ok(val) = max_connections
{
config.database.max_connections = val;
}
if let Ok(min_connections) =
env::var("OXICLOUD_DB_MIN_CONNECTIONS").map(|v| v.parse::<u32>())
&& let Ok(val) = min_connections
{
config.database.min_connections = val;
}
// Auth configuration
if let Ok(jwt_secret) = env::var("OXICLOUD_JWT_SECRET") {
config.auth.jwt_secret = jwt_secret;
}
// SECURITY: Validate JWT secret when auth is enabled
if config.features.enable_auth && config.auth.jwt_secret.is_empty() {
// Generate a random secret for this session and warn loudly
@@ -459,7 +478,7 @@ impl AppConfig {
OsRng.fill_bytes(&mut key);
let generated_secret: String = key.iter().map(|b| format!("{:02x}", b)).collect();
config.auth.jwt_secret = generated_secret;
tracing::warn!("==========================================================");
tracing::warn!("OXICLOUD_JWT_SECRET is not set.");
tracing::warn!("A random secret has been generated for this session.");
@@ -467,50 +486,54 @@ impl AppConfig {
tracing::warn!("Set OXICLOUD_JWT_SECRET env var for production use.");
tracing::warn!("==========================================================");
}
if let Ok(access_token_expiry) = env::var("OXICLOUD_ACCESS_TOKEN_EXPIRY_SECS")
.map(|v| v.parse::<i64>())
&& let Ok(val) = access_token_expiry {
config.auth.access_token_expiry_secs = val;
}
if let Ok(refresh_token_expiry) = env::var("OXICLOUD_REFRESH_TOKEN_EXPIRY_SECS")
.map(|v| v.parse::<i64>())
&& let Ok(val) = refresh_token_expiry {
config.auth.refresh_token_expiry_secs = val;
}
if let Ok(access_token_expiry) =
env::var("OXICLOUD_ACCESS_TOKEN_EXPIRY_SECS").map(|v| v.parse::<i64>())
&& let Ok(val) = access_token_expiry
{
config.auth.access_token_expiry_secs = val;
}
if let Ok(refresh_token_expiry) =
env::var("OXICLOUD_REFRESH_TOKEN_EXPIRY_SECS").map(|v| v.parse::<i64>())
&& let Ok(val) = refresh_token_expiry
{
config.auth.refresh_token_expiry_secs = val;
}
// Feature flags
if let Ok(enable_auth) = env::var("OXICLOUD_ENABLE_AUTH")
.map(|v| v.parse::<bool>())
&& let Ok(val) = enable_auth {
config.features.enable_auth = val;
}
if let Ok(enable_user_storage_quotas) = env::var("OXICLOUD_ENABLE_USER_STORAGE_QUOTAS")
.map(|v| v.parse::<bool>())
&& let Ok(val) = enable_user_storage_quotas {
config.features.enable_user_storage_quotas = val;
}
if let Ok(enable_file_sharing) = env::var("OXICLOUD_ENABLE_FILE_SHARING")
.map(|v| v.parse::<bool>())
&& let Ok(val) = enable_file_sharing {
config.features.enable_file_sharing = val;
}
if let Ok(enable_trash) = env::var("OXICLOUD_ENABLE_TRASH")
.map(|v| v.parse::<bool>())
&& let Ok(val) = enable_trash {
config.features.enable_trash = val;
}
if let Ok(enable_search) = env::var("OXICLOUD_ENABLE_SEARCH")
.map(|v| v.parse::<bool>())
&& let Ok(val) = enable_search {
config.features.enable_search = val;
}
if let Ok(enable_auth) = env::var("OXICLOUD_ENABLE_AUTH").map(|v| v.parse::<bool>())
&& let Ok(val) = enable_auth
{
config.features.enable_auth = val;
}
if let Ok(enable_user_storage_quotas) =
env::var("OXICLOUD_ENABLE_USER_STORAGE_QUOTAS").map(|v| v.parse::<bool>())
&& let Ok(val) = enable_user_storage_quotas
{
config.features.enable_user_storage_quotas = val;
}
if let Ok(enable_file_sharing) =
env::var("OXICLOUD_ENABLE_FILE_SHARING").map(|v| v.parse::<bool>())
&& let Ok(val) = enable_file_sharing
{
config.features.enable_file_sharing = val;
}
if let Ok(enable_trash) = env::var("OXICLOUD_ENABLE_TRASH").map(|v| v.parse::<bool>())
&& let Ok(val) = enable_trash
{
config.features.enable_trash = val;
}
if let Ok(enable_search) = env::var("OXICLOUD_ENABLE_SEARCH").map(|v| v.parse::<bool>())
&& let Ok(val) = enable_search
{
config.features.enable_search = val;
}
// OIDC configuration
if let Ok(v) = env::var("OXICLOUD_OIDC_ENABLED") {
config.oidc.enabled = v.parse::<bool>().unwrap_or(false);
@@ -548,23 +571,28 @@ impl AppConfig {
// Validate OIDC config when enabled
if config.oidc.enabled
&& (config.oidc.issuer_url.is_empty() || config.oidc.client_id.is_empty() || config.oidc.client_secret.is_empty()) {
tracing::error!("OIDC is enabled but OXICLOUD_OIDC_ISSUER_URL, OXICLOUD_OIDC_CLIENT_ID, or OXICLOUD_OIDC_CLIENT_SECRET are not set");
config.oidc.enabled = false;
}
&& (config.oidc.issuer_url.is_empty()
|| config.oidc.client_id.is_empty()
|| config.oidc.client_secret.is_empty())
{
tracing::error!(
"OIDC is enabled but OXICLOUD_OIDC_ISSUER_URL, OXICLOUD_OIDC_CLIENT_ID, or OXICLOUD_OIDC_CLIENT_SECRET are not set"
);
config.oidc.enabled = false;
}
config
}
pub fn with_features(mut self, features: FeaturesConfig) -> Self {
self.features = features;
self
}
pub fn db_enabled(&self) -> bool {
self.features.enable_auth
}
pub fn auth_enabled(&self) -> bool {
self.features.enable_auth
}
@@ -595,4 +623,4 @@ impl AppConfig {
/// Gets a default global configuration
pub fn default_config() -> AppConfig {
AppConfig::default()
}
}
+330 -252
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,4 +1,4 @@
pub mod errors;
pub mod config;
pub mod di;
pub mod stubs;
pub mod errors;
pub mod stubs;
+55 -106
View File
@@ -14,23 +14,25 @@ use bytes::Bytes;
use futures::Stream;
use crate::application::dtos::file_dto::FileDto;
use crate::application::dtos::folder_dto::{CreateFolderDto, FolderDto, MoveFolderDto, RenameFolderDto};
use crate::application::dtos::folder_dto::{
CreateFolderDto, FolderDto, MoveFolderDto, RenameFolderDto,
};
use crate::application::dtos::pagination::{PaginatedResponseDto, PaginationRequestDto};
use crate::application::dtos::search_dto::{SearchCriteriaDto, SearchResultsDto};
use crate::application::ports::compression_ports::{CompressionLevel, CompressionPort};
use crate::application::ports::file_ports::{
FileManagementUseCase, FileRetrievalUseCase, FileUploadUseCase, FileUseCaseFactory,
UploadStrategy, OptimizedFileContent,
OptimizedFileContent, UploadStrategy,
};
use crate::application::ports::inbound::{FolderUseCase, SearchUseCase};
use crate::application::ports::outbound::IdMappingPort;
use crate::domain::repositories::folder_repository::FolderRepository;
use crate::application::ports::storage_ports::{FileReadPort, FileWritePort};
use crate::application::ports::zip_ports::ZipPort;
use crate::application::services::storage_mediator::{StorageMediator, StorageMediatorError};
use crate::common::errors::DomainError;
use crate::domain::entities::file::File;
use crate::domain::entities::folder::Folder;
use crate::domain::repositories::folder_repository::FolderRepository;
use crate::domain::services::i18n_service::{I18nResult, I18nService, Locale};
use crate::domain::services::path_service::StoragePath;
@@ -89,10 +91,7 @@ pub struct StubIdMappingService;
#[async_trait]
impl IdMappingPort for StubIdMappingService {
async fn get_or_create_id(
&self,
_path: &StoragePath,
) -> Result<String, DomainError> {
async fn get_or_create_id(&self, _path: &StoragePath) -> Result<String, DomainError> {
Ok("dummy-id".to_string())
}
@@ -100,11 +99,7 @@ impl IdMappingPort for StubIdMappingService {
Ok(StoragePath::from_string("/"))
}
async fn update_path(
&self,
_id: &str,
_new_path: &StoragePath,
) -> Result<(), DomainError> {
async fn update_path(&self, _id: &str, _new_path: &StoragePath) -> Result<(), DomainError> {
Ok(())
}
@@ -125,10 +120,7 @@ pub struct StubStorageMediator;
#[async_trait]
impl StorageMediator for StubStorageMediator {
async fn get_folder_path(
&self,
_folder_id: &str,
) -> Result<PathBuf, StorageMediatorError> {
async fn get_folder_path(&self, _folder_id: &str) -> Result<PathBuf, StorageMediatorError> {
Ok(PathBuf::from("/tmp"))
}
@@ -139,19 +131,13 @@ impl StorageMediator for StubStorageMediator {
Ok(StoragePath::root())
}
async fn get_folder(
&self,
_folder_id: &str,
) -> Result<Folder, StorageMediatorError> {
async fn get_folder(&self, _folder_id: &str) -> Result<Folder, StorageMediatorError> {
Err(StorageMediatorError::NotFound(
"Stub not implemented".to_string(),
))
}
async fn file_exists_at_path(
&self,
_path: &Path,
) -> Result<bool, StorageMediatorError> {
async fn file_exists_at_path(&self, _path: &Path) -> Result<bool, StorageMediatorError> {
Ok(false)
}
@@ -162,10 +148,7 @@ impl StorageMediator for StubStorageMediator {
Ok(false)
}
async fn folder_exists_at_path(
&self,
_path: &Path,
) -> Result<bool, StorageMediatorError> {
async fn folder_exists_at_path(&self, _path: &Path) -> Result<bool, StorageMediatorError> {
Ok(false)
}
@@ -184,10 +167,7 @@ impl StorageMediator for StubStorageMediator {
PathBuf::from("/tmp")
}
async fn ensure_directory(
&self,
_path: &Path,
) -> Result<(), StorageMediatorError> {
async fn ensure_directory(&self, _path: &Path) -> Result<(), StorageMediatorError> {
Ok(())
}
@@ -236,10 +216,7 @@ impl FileReadPort for StubFileReadPort {
Ok(File::default())
}
async fn list_files(
&self,
_folder_id: Option<&str>,
) -> Result<Vec<File>, DomainError> {
async fn list_files(&self, _folder_id: Option<&str>) -> Result<Vec<File>, DomainError> {
Ok(Vec::new())
}
@@ -314,11 +291,7 @@ impl FileWritePort for StubFileWritePort {
Ok(File::default())
}
async fn rename_file(
&self,
_file_id: &str,
_new_name: &str,
) -> Result<File, DomainError> {
async fn rename_file(&self, _file_id: &str, _new_name: &str) -> Result<File, DomainError> {
Ok(File::default())
}
@@ -348,7 +321,11 @@ impl FileWritePort for StubFileWritePort {
Ok(())
}
async fn restore_from_trash(&self, _file_id: &str, _original_path: &str) -> Result<(), DomainError> {
async fn restore_from_trash(
&self,
_file_id: &str,
_original_path: &str,
) -> Result<(), DomainError> {
Ok(())
}
@@ -377,17 +354,11 @@ impl FolderRepository for StubFolderStoragePort {
Ok(Folder::default())
}
async fn get_folder_by_path(
&self,
_storage_path: &StoragePath,
) -> Result<Folder, DomainError> {
async fn get_folder_by_path(&self, _storage_path: &StoragePath) -> Result<Folder, DomainError> {
Ok(Folder::default())
}
async fn list_folders(
&self,
_parent_id: Option<&str>,
) -> Result<Vec<Folder>, DomainError> {
async fn list_folders(&self, _parent_id: Option<&str>) -> Result<Vec<Folder>, DomainError> {
Ok(Vec::new())
}
@@ -401,11 +372,7 @@ impl FolderRepository for StubFolderStoragePort {
Ok((Vec::new(), Some(0)))
}
async fn rename_folder(
&self,
_id: &str,
_new_name: String,
) -> Result<Folder, DomainError> {
async fn rename_folder(&self, _id: &str, _new_name: String) -> Result<Folder, DomainError> {
Ok(Folder::default())
}
@@ -421,17 +388,11 @@ impl FolderRepository for StubFolderStoragePort {
Ok(())
}
async fn folder_exists(
&self,
_storage_path: &StoragePath,
) -> Result<bool, DomainError> {
async fn folder_exists(&self, _storage_path: &StoragePath) -> Result<bool, DomainError> {
Ok(false)
}
async fn get_folder_path(
&self,
_id: &str,
) -> Result<StoragePath, DomainError> {
async fn get_folder_path(&self, _id: &str) -> Result<StoragePath, DomainError> {
Ok(StoragePath::from_string("/"))
}
@@ -439,7 +400,11 @@ impl FolderRepository for StubFolderStoragePort {
Ok(())
}
async fn restore_from_trash(&self, _folder_id: &str, _original_path: &str) -> Result<(), DomainError> {
async fn restore_from_trash(
&self,
_folder_id: &str,
_original_path: &str,
) -> Result<(), DomainError> {
Ok(())
}
@@ -481,10 +446,7 @@ pub struct StubFolderUseCase;
#[async_trait]
impl FolderUseCase for StubFolderUseCase {
async fn create_folder(
&self,
_dto: CreateFolderDto,
) -> Result<FolderDto, DomainError> {
async fn create_folder(&self, _dto: CreateFolderDto) -> Result<FolderDto, DomainError> {
Ok(FolderDto::default())
}
@@ -492,17 +454,11 @@ impl FolderUseCase for StubFolderUseCase {
Ok(FolderDto::default())
}
async fn get_folder_by_path(
&self,
_path: &str,
) -> Result<FolderDto, DomainError> {
async fn get_folder_by_path(&self, _path: &str) -> Result<FolderDto, DomainError> {
Ok(FolderDto::default())
}
async fn list_folders(
&self,
_parent_id: Option<&str>,
) -> Result<Vec<FolderDto>, DomainError> {
async fn list_folders(&self, _parent_id: Option<&str>) -> Result<Vec<FolderDto>, DomainError> {
Ok(Vec::new())
}
@@ -522,11 +478,7 @@ impl FolderUseCase for StubFolderUseCase {
Ok(FolderDto::default())
}
async fn move_folder(
&self,
_id: &str,
_dto: MoveFolderDto,
) -> Result<FolderDto, DomainError> {
async fn move_folder(&self, _id: &str, _dto: MoveFolderDto) -> Result<FolderDto, DomainError> {
Ok(FolderDto::default())
}
@@ -564,7 +516,13 @@ impl FileUploadUseCase for StubFileUploadUseCase {
Ok((FileDto::default(), UploadStrategy::Buffered))
}
async fn create_file(&self, _parent_path: &str, _filename: &str, _content: &[u8], _content_type: &str) -> Result<FileDto, DomainError> {
async fn create_file(
&self,
_parent_path: &str,
_filename: &str,
_content: &[u8],
_content_type: &str,
) -> Result<FileDto, DomainError> {
Ok(FileDto::default())
}
@@ -585,10 +543,7 @@ impl FileRetrievalUseCase for StubFileRetrievalUseCase {
Ok(FileDto::default())
}
async fn list_files(
&self,
_folder_id: Option<&str>,
) -> Result<Vec<FileDto>, DomainError> {
async fn list_files(&self, _folder_id: Option<&str>) -> Result<Vec<FileDto>, DomainError> {
Ok(Vec::new())
}
@@ -610,11 +565,14 @@ impl FileRetrievalUseCase for StubFileRetrievalUseCase {
_accept_webp: bool,
_prefer_original: bool,
) -> Result<(FileDto, OptimizedFileContent), DomainError> {
Ok((FileDto::default(), OptimizedFileContent::Bytes {
data: Bytes::new(),
mime_type: String::new(),
was_transcoded: false,
}))
Ok((
FileDto::default(),
OptimizedFileContent::Bytes {
data: Bytes::new(),
mime_type: String::new(),
was_transcoded: false,
},
))
}
async fn get_file_range_stream(
@@ -648,11 +606,7 @@ impl FileManagementUseCase for StubFileManagementUseCase {
Ok(FileDto::default())
}
async fn rename_file(
&self,
_file_id: &str,
_new_name: &str,
) -> Result<FileDto, DomainError> {
async fn rename_file(&self, _file_id: &str, _new_name: &str) -> Result<FileDto, DomainError> {
Ok(FileDto::default())
}
@@ -660,11 +614,7 @@ impl FileManagementUseCase for StubFileManagementUseCase {
Ok(())
}
async fn delete_with_cleanup(
&self,
_id: &str,
_user_id: &str,
) -> Result<bool, DomainError> {
async fn delete_with_cleanup(&self, _id: &str, _user_id: &str) -> Result<bool, DomainError> {
Ok(false)
}
}
@@ -697,10 +647,7 @@ pub struct StubSearchUseCase;
#[async_trait]
impl SearchUseCase for StubSearchUseCase {
async fn search(
&self,
_criteria: SearchCriteriaDto,
) -> Result<SearchResultsDto, DomainError> {
async fn search(&self, _criteria: SearchCriteriaDto) -> Result<SearchResultsDto, DomainError> {
Ok(SearchResultsDto::empty())
}
@@ -713,7 +660,9 @@ impl SearchUseCase for StubSearchUseCase {
// MetadataCachePort
// ---------------------------------------------------------------------------
use crate::application::ports::cache_ports::{MetadataCachePort, CachedMetadataDto, ContentCachePort};
use crate::application::ports::cache_ports::{
CachedMetadataDto, ContentCachePort, MetadataCachePort,
};
pub struct StubMetadataCachePort;