fixing bugs

This commit is contained in:
DioCrafts
2025-03-23 22:44:18 +01:00
parent 72de043184
commit 9a9fd72f61
54 changed files with 2593 additions and 513 deletions
+16 -3
View File
@@ -4,11 +4,16 @@ use sqlx::PgPool;
use crate::domain::services::auth_service::AuthService;
use crate::application::services::auth_application_service::AuthApplicationService;
use crate::application::services::folder_service::FolderService;
use crate::infrastructure::repositories::{UserPgRepository, SessionPgRepository};
use crate::common::config::AppConfig;
use crate::common::di::AuthServices;
pub async fn create_auth_services(config: &AppConfig, pool: Arc<PgPool>) -> Result<AuthServices> {
pub async fn create_auth_services(
config: &AppConfig,
pool: Arc<PgPool>,
folder_service: Option<Arc<FolderService>>
) -> Result<AuthServices> {
// Crear servicio de dominio de autenticación
let auth_service = Arc::new(AuthService::new(
config.auth.jwt_secret.clone(),
@@ -21,11 +26,19 @@ pub async fn create_auth_services(config: &AppConfig, pool: Arc<PgPool>) -> Resu
let session_repository = Arc::new(SessionPgRepository::new(pool.clone()));
// Crear servicio de aplicación de autenticación
let auth_application_service = Arc::new(AuthApplicationService::new(
let mut auth_app_service = AuthApplicationService::new(
user_repository,
session_repository,
auth_service.clone(),
));
);
// Configurar servicio de carpetas si está disponible
if let Some(folder_svc) = folder_service {
auth_app_service = auth_app_service.with_folder_service(folder_svc);
}
// Empaquetar servicio en Arc
let auth_application_service = Arc::new(auth_app_service);
Ok(AuthServices {
auth_service,