init projectmycelium

This commit is contained in:
mik-tf
2025-09-01 21:37:01 -04:00
commit b41efb0e99
319 changed files with 128160 additions and 0 deletions

35
src/services/factory.rs Normal file
View File

@@ -0,0 +1,35 @@
use std::sync::Arc;
use crate::services::{
currency::CurrencyService,
user_persistence::UserPersistence,
};
/// Service factory for single source of truth service instantiation
///
/// This factory consolidates repeated service instantiations throughout
/// the Project Mycelium codebase, focusing on persistent data access
/// and eliminating mock data usage in favor of user_data/ directory.
///
/// Usage:
/// ```rust,ignore
/// let currency_service = ServiceFactory::currency_service();
/// ```
pub struct ServiceFactory;
impl ServiceFactory {
/// Creates a new CurrencyService instance using persistent data
///
/// This replaces scattered CurrencyService instantiations throughout the codebase
/// with a single source of truth, using persistent data instead of mock data.
pub fn currency_service() -> Arc<CurrencyService> {
Arc::new(CurrencyService::builder().build().unwrap())
}
/// Provides access to UserPersistence for persistent data operations
///
/// This provides centralized access to persistent user data from user_data/
/// directory, eliminating the need for mock data services.
pub fn user_persistence() -> UserPersistence {
UserPersistence
}
}