chore: translate all Spanish comments and log messages to English
This commit is contained in:
@@ -44,12 +44,12 @@ impl From<File> for FileDto {
|
||||
}
|
||||
}
|
||||
|
||||
// Para convertir de FileDto a File para los batch handlers
|
||||
// To convert from FileDto to File for batch handlers
|
||||
impl From<FileDto> for File {
|
||||
fn from(dto: FileDto) -> Self {
|
||||
// Usar constructor para crear una entidad desde DTO
|
||||
// Nota: esto debe simplificarse si File tiene un constructor adecuado
|
||||
// Si no, deberías hacer la conversión de la mejor manera posible
|
||||
// Use constructor to create an entity from DTO
|
||||
// Note: this should be simplified if File has a proper constructor
|
||||
// If not, make the conversion as best as possible
|
||||
File::from_dto(
|
||||
dto.id,
|
||||
dto.name,
|
||||
|
||||
@@ -66,11 +66,11 @@ impl From<Folder> for FolderDto {
|
||||
}
|
||||
}
|
||||
|
||||
// Para convertir de FolderDto a Folder para los batch handlers
|
||||
// To convert from FolderDto to Folder for batch handlers
|
||||
impl From<FolderDto> for Folder {
|
||||
fn from(dto: FolderDto) -> Self {
|
||||
// Usar constructor para crear una entidad desde DTO
|
||||
// Nota: esto debe simplificarse si Folder tiene un constructor adecuado
|
||||
// Use constructor to create an entity from DTO
|
||||
// Note: this should be simplified if Folder has a proper constructor
|
||||
Folder::from_dto(
|
||||
dto.id,
|
||||
dto.name,
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
/// Un DTO para representar información de paginación
|
||||
/// A DTO to represent pagination information
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PaginationDto {
|
||||
/// Página actual (comienza en 0)
|
||||
/// Current page (starts at 0)
|
||||
pub page: usize,
|
||||
/// Tamaño de página
|
||||
/// Page size
|
||||
pub page_size: usize,
|
||||
/// Número total de elementos
|
||||
/// Total number of items
|
||||
pub total_items: usize,
|
||||
/// Número total de páginas
|
||||
/// Total number of pages
|
||||
pub total_pages: usize,
|
||||
/// Indica si hay una página siguiente
|
||||
/// Indicates if there is a next page
|
||||
pub has_next: bool,
|
||||
/// Indica si hay una página anterior
|
||||
/// Indicates if there is a previous page
|
||||
pub has_prev: bool,
|
||||
}
|
||||
|
||||
/// Un DTO para representar una solicitud de paginación
|
||||
/// A DTO to represent a pagination request
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PaginationRequestDto {
|
||||
/// Página solicitada (comienza en 0)
|
||||
/// Requested page (starts at 0)
|
||||
#[serde(default)]
|
||||
pub page: usize,
|
||||
/// Tamaño de página solicitado
|
||||
/// Requested page size
|
||||
#[serde(default = "default_page_size")]
|
||||
pub page_size: usize,
|
||||
}
|
||||
|
||||
/// Un DTO para representar una respuesta paginada
|
||||
/// A DTO to represent a paginated response
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PaginatedResponseDto<T> {
|
||||
/// Datos en la página actual
|
||||
/// Data on the current page
|
||||
pub items: Vec<T>,
|
||||
/// Información de paginación
|
||||
/// Pagination information
|
||||
pub pagination: PaginationDto,
|
||||
}
|
||||
|
||||
@@ -46,33 +46,33 @@ impl Default for PaginationRequestDto {
|
||||
}
|
||||
}
|
||||
|
||||
/// Función para establecer el tamaño de página por defecto
|
||||
/// Function to set the default page size
|
||||
fn default_page_size() -> usize {
|
||||
100 // Por defecto, 100 items por página
|
||||
100 // By default, 100 items per page
|
||||
}
|
||||
|
||||
impl PaginationRequestDto {
|
||||
/// Calcula el offset para consultas paginadas
|
||||
/// Calculates the offset for paginated queries
|
||||
pub fn offset(&self) -> usize {
|
||||
self.page * self.page_size
|
||||
}
|
||||
|
||||
/// Calcula el límite para consultas paginadas
|
||||
/// Calculates the limit for paginated queries
|
||||
pub fn limit(&self) -> usize {
|
||||
self.page_size
|
||||
}
|
||||
|
||||
/// Valida y ajusta los parámetros de paginación
|
||||
/// Validates and adjusts the pagination parameters
|
||||
pub fn validate_and_adjust(&self) -> Self {
|
||||
let mut page = self.page;
|
||||
let mut page_size = self.page_size;
|
||||
|
||||
// Asegurar que la página sea al menos 0
|
||||
// Ensure the page is at least 0
|
||||
if page < 1 {
|
||||
page = 0;
|
||||
}
|
||||
|
||||
// Asegurar que el tamaño de página esté entre 10 y 500
|
||||
// Ensure the page size is between 10 and 500
|
||||
if page_size < 10 {
|
||||
page_size = 10;
|
||||
} else if page_size > 500 {
|
||||
@@ -87,7 +87,7 @@ impl PaginationRequestDto {
|
||||
}
|
||||
|
||||
impl<T> PaginatedResponseDto<T> {
|
||||
/// Crea una nueva respuesta paginada a partir de los datos y la información de paginación
|
||||
/// Creates a new paginated response from the data and pagination information
|
||||
pub fn new(
|
||||
items: Vec<T>,
|
||||
page: usize,
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
/// DTO para elementos recientes
|
||||
/// DTO for recent items
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct RecentItemDto {
|
||||
/// Identificador único para el elemento reciente
|
||||
/// Unique identifier for the recent item
|
||||
pub id: String,
|
||||
|
||||
/// ID del usuario propietario
|
||||
/// Owner user ID
|
||||
pub user_id: String,
|
||||
|
||||
/// ID del elemento (archivo o carpeta)
|
||||
/// Item ID (file or folder)
|
||||
pub item_id: String,
|
||||
|
||||
/// Tipo del elemento ('file' o 'folder')
|
||||
/// Item type ('file' or 'folder')
|
||||
pub item_type: String,
|
||||
|
||||
/// Cuándo se accedió al elemento
|
||||
/// When the item was accessed
|
||||
pub accessed_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -67,7 +67,7 @@ pub struct RefreshTokenDto {
|
||||
pub refresh_token: String,
|
||||
}
|
||||
|
||||
/// Datos del usuario autenticado actual (para uso en servicios de application)
|
||||
/// Authenticated current user data (for use in application services)
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct CurrentUser {
|
||||
pub id: String,
|
||||
|
||||
Reference in New Issue
Block a user