chore: translate all Spanish comments and log messages to English

This commit is contained in:
Dionisio
2026-02-12 09:41:25 +01:00
parent bc169de8f6
commit d31a413e57
89 changed files with 2480 additions and 2482 deletions
+17 -17
View File
@@ -5,17 +5,17 @@ use crate::common::errors::{Result, DomainError, ErrorKind};
use crate::application::ports::recent_ports::{RecentItemsUseCase, RecentItemsRepositoryPort};
use crate::application::dtos::recent_dto::RecentItemDto;
/// Implementación del caso de uso para gestionar elementos recientes.
/// Implementation of the use case for managing recent items.
///
/// Depende de `RecentItemsRepositoryPort` (outbound port) en lugar
/// de acceder directamente a `PgPool`, siguiendo la arquitectura hexagonal.
/// Depends on `RecentItemsRepositoryPort` (outbound port) instead
/// of accessing `PgPool` directly, following the hexagonal architecture.
pub struct RecentService {
repo: Arc<dyn RecentItemsRepositoryPort>,
max_recent_items: i32,
}
impl RecentService {
/// Crear un nuevo servicio de elementos recientes
/// Create a new recent items service
pub fn new(repo: Arc<dyn RecentItemsRepositoryPort>, max_recent_items: i32) -> Self {
Self {
repo,
@@ -26,51 +26,51 @@ impl RecentService {
#[async_trait]
impl RecentItemsUseCase for RecentService {
/// Obtener elementos recientes de un usuario
/// Get recent items for a user
async fn get_recent_items(&self, user_id: &str, limit: Option<i32>) -> Result<Vec<RecentItemDto>> {
info!("Obteniendo elementos recientes para usuario: {}", user_id);
info!("Getting recent items for user: {}", user_id);
let limit_value = limit.unwrap_or(self.max_recent_items).min(self.max_recent_items);
let items = self.repo.get_recent_items(user_id, limit_value).await?;
info!("Recuperados {} elementos recientes para usuario {}", items.len(), user_id);
info!("Retrieved {} recent items for user {}", items.len(), user_id);
Ok(items)
}
/// Registrar acceso a un elemento
/// Record access to an item
async fn record_item_access(&self, user_id: &str, item_id: &str, item_type: &str) -> Result<()> {
info!("Registrando acceso a {} '{}' para usuario {}", item_type, item_id, user_id);
info!("Recording access to {} '{}' for user {}", item_type, item_id, user_id);
if item_type != "file" && item_type != "folder" {
return Err(DomainError::new(
ErrorKind::InvalidInput,
"RecentItems",
"El tipo de elemento debe ser 'file' o 'folder'",
"Item type must be 'file' or 'folder'",
));
}
self.repo.upsert_access(user_id, item_id, item_type).await?;
self.repo.prune(user_id, self.max_recent_items).await?;
info!("Registrado correctamente acceso a {} '{}' para usuario {}", item_type, item_id, user_id);
info!("Successfully recorded access to {} '{}' for user {}", item_type, item_id, user_id);
Ok(())
}
/// Eliminar un elemento de recientes
/// Remove an item from recent
async fn remove_from_recent(&self, user_id: &str, item_id: &str, item_type: &str) -> Result<bool> {
info!("Eliminando {} '{}' de recientes para usuario {}", item_type, item_id, user_id);
info!("Removing {} '{}' from recent for user {}", item_type, item_id, user_id);
let removed = self.repo.remove_item(user_id, item_id, item_type).await?;
info!(
"{} {} '{}' de recientes para usuario {}",
if removed { "Eliminado correctamente" } else { "No se encontró" },
if removed { "Successfully removed" } else { "Not found" },
item_type, item_id, user_id
);
Ok(removed)
}
/// Limpiar todos los elementos recientes
/// Clear all recent items
async fn clear_recent_items(&self, user_id: &str) -> Result<()> {
info!("Limpiando todos los elementos recientes para usuario {}", user_id);
info!("Clearing all recent items for user {}", user_id);
self.repo.clear_all(user_id).await?;
info!("Limpiados todos los elementos recientes para usuario {}", user_id);
info!("Cleared all recent items for user {}", user_id);
Ok(())
}
}