fix(domain): ImportSession::new() generates own ID, add from_persistence()

This commit is contained in:
2026-06-12 01:41:03 +02:00
parent cedb13d7a8
commit b844339795
7 changed files with 67 additions and 66 deletions

View File

@@ -5,6 +5,7 @@ use domain::{
models::{
AnnotatedRow, FieldMapping, ImportSession, ParsedFile,
import::{DomainField, ImportRow, RowResult, Transform},
import_session::PersistedImportSession,
},
ports::ImportSessionRepository,
value_objects::{ImportSessionId, UserId},
@@ -266,7 +267,7 @@ impl PostgresImportSessionRepository {
Ok(js.into_iter().map(annotated_from_json).collect())
})
.transpose()?;
Ok(ImportSession {
Ok(ImportSession::from_persistence(PersistedImportSession {
id: ImportSessionId::from_uuid(
id.parse::<uuid::Uuid>()
.map_err(|e| DomainError::InfrastructureError(e.to_string()))?,
@@ -281,7 +282,7 @@ impl PostgresImportSessionRepository {
row_results,
created_at,
expires_at,
})
}))
}
}