refactor: remove serde from domain entities for Clean Architecture compliance

- Remove Serialize/Deserialize from File, Folder, Session, User, Contact entities
- Create contact_persistence_dto.rs for JSONB persistence in infrastructure layer
- Update contact_pg_repository to use persistence DTOs
- Fix dependency on zip crate (downgrade from 7.2.0 to 2.1.0)
- Fix unused variable warnings in main.rs
- Move PathService import from domain to infrastructure
- Add missing fields to CoreServices and RepositoryServices
- Create proper service initialization in main.rs

Clean Architecture improvements:
- Domain layer no longer depends on serde framework
- Persistence concerns isolated to infrastructure layer
- TokenClaims in auth_service.rs is only exception (required for JWT)
This commit is contained in:
Dionisio
2026-02-02 23:56:40 +01:00
parent 6aceb07f3f
commit 52840e57df
88 changed files with 4286 additions and 4847 deletions
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use sqlx::types::Uuid;
use uuid::Uuid;
use std::result::Result;
use crate::common::errors::DomainError;
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use sqlx::types::Uuid;
use uuid::Uuid;
use std::result::Result;
use crate::common::errors::DomainError;
@@ -12,7 +12,6 @@ use bytes::Bytes;
* operations, providing detailed context for error handling across the application.
*/
#[derive(Debug, thiserror::Error)]
#[allow(dead_code)]
pub enum FileRepositoryError {
/// Returned when a requested file cannot be found by ID or path
#[error("File not found: {0}")]
@@ -109,7 +108,6 @@ pub trait FileRepository: Send + Sync + 'static {
* @param content Binary data of the file
* @return The created File entity on success, error otherwise
*/
#[allow(dead_code)]
async fn save_file_with_id(
&self,
id: String,
@@ -152,7 +150,6 @@ pub trait FileRepository: Send + Sync + 'static {
* @param id The unique identifier of the file to delete
* @return Success or error
*/
#[allow(dead_code)]
async fn delete_file_entry(&self, id: &str) -> FileRepositoryResult<()>;
/**
@@ -5,7 +5,6 @@ use crate::common::errors::DomainError;
/// Error types for folder repository operations
#[derive(Debug, thiserror::Error)]
#[allow(dead_code)]
pub enum FolderRepositoryError {
#[error("Folder not found: {0}")]
NotFound(String),
@@ -84,12 +83,10 @@ pub trait FolderRepository: Send + Sync + 'static {
/// Legacy method - checks if a folder exists at the given PathBuf path
#[deprecated(note = "Use folder_exists_at_storage_path instead")]
#[allow(dead_code)]
async fn folder_exists(&self, path: &std::path::PathBuf) -> FolderRepositoryResult<bool>;
/// Legacy method - gets a folder by its PathBuf path
#[deprecated(note = "Use get_folder_by_storage_path instead")]
#[allow(dead_code)]
async fn get_folder_by_path(&self, path: &std::path::PathBuf) -> FolderRepositoryResult<Folder>;
/// Moves a folder to trash