movie detail page + importer architecture fix

This commit is contained in:
2026-05-10 23:59:26 +02:00
parent f2f1317660
commit b2a2aa4262
49 changed files with 1670 additions and 264 deletions

View File

@@ -1,12 +1,28 @@
pub mod error;
pub mod mapper;
pub mod parsers;
pub mod types;
mod mapper;
mod parsers;
pub use error::ImportError;
pub use mapper::apply_mapping;
pub use parsers::{parse_csv, parse_json};
pub use types::{AnnotatedRow, DomainField, FieldMapping, ImportRow, ParsedFile, RowResult, Transform};
use domain::{
models::{AnnotatedRow, FieldMapping, FileFormat, ImportError, ParsedFile},
ports::DocumentParser,
};
#[cfg(feature = "xlsx")]
pub use parsers::parse_xlsx;
pub struct ImporterDocumentParser;
impl DocumentParser for ImporterDocumentParser {
fn parse(&self, bytes: &[u8], format: FileFormat) -> Result<ParsedFile, ImportError> {
match format {
FileFormat::Csv => parsers::parse_csv(bytes),
FileFormat::Json => parsers::parse_json(bytes),
FileFormat::Xlsx => {
#[cfg(feature = "xlsx")]
{ parsers::parse_xlsx(bytes) }
#[cfg(not(feature = "xlsx"))]
{ Err(ImportError::Xlsx("XLSX support not compiled in".into())) }
}
}
}
fn apply_mapping(&self, file: &ParsedFile, mappings: &[FieldMapping]) -> Vec<AnnotatedRow> {
mapper::apply_mapping(file, mappings)
}
}