@@ -5,8 +5,6 @@ use domain::{
|
||||
|
||||
use super::{commands::ApplyImportProfileCommand, deps::ApplyProfileDeps};
|
||||
|
||||
/// Copies the profile's field_mappings onto the session. Caller must then invoke
|
||||
/// apply_import_mapping to regenerate row_results with the new mappings.
|
||||
pub async fn execute(
|
||||
deps: &ApplyProfileDeps,
|
||||
cmd: ApplyImportProfileCommand,
|
||||
|
||||
@@ -50,11 +50,6 @@ pub struct ListImportProfilesDeps {
|
||||
pub import_profile: Arc<dyn ImportProfileRepository>,
|
||||
}
|
||||
|
||||
/// Backs `apply_profile_and_map`, which internally drives `apply_profile::execute`
|
||||
/// then `apply_mapping::execute` — these fields are exactly the union of
|
||||
/// `ApplyProfileDeps` and `ApplyMappingDeps`'s fields, cloned once here and used to
|
||||
/// build each nested deps struct inline at the call site (see that file's doc
|
||||
/// comment for why: no use-case signature changes, per this task's constraints).
|
||||
pub struct ApplyProfileAndMapDeps {
|
||||
pub import_profile: Arc<dyn ImportProfileRepository>,
|
||||
pub import_session: Arc<dyn ImportSessionRepository>,
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
//! The mapping-page stage gate: a session must exist and have a `parsed_file`
|
||||
//! before its columns/sample rows can be shown for field mapping. Absorbs
|
||||
//! `handlers/import.rs::get_mapping_page`'s two early-return checks (session
|
||||
//! missing, `parsed_file` absent) — both collapse to `NotFound` here since the
|
||||
//! handler redirected to the same place (`/import`) for either.
|
||||
|
||||
use domain::{errors::DomainError, value_objects::ImportSessionId};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::import::deps::GetMappingStageDeps;
|
||||
|
||||
/// Cap on sample rows shown on the mapping page — was a bare `.take(5)` in the
|
||||
/// handler.
|
||||
pub const SAMPLE_ROW_LIMIT: usize = 5;
|
||||
|
||||
pub struct MappingStage {
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
//! The preview-page stage gate: a session must have `row_results` (i.e. a
|
||||
//! mapping has already been applied) before its rows can be previewed. Serves
|
||||
//! both the HTML preview handler and the API preview handler —
|
||||
//! `handlers/import.rs::get_preview_page` and `::api_get_preview` — which
|
||||
//! render/respond to `NotYetMapped` differently (redirect vs. status code); that
|
||||
//! decision stays in the handlers, not here.
|
||||
|
||||
use domain::{
|
||||
errors::DomainError,
|
||||
models::AnnotatedRow,
|
||||
@@ -14,15 +7,6 @@ use uuid::Uuid;
|
||||
|
||||
use crate::import::deps::GetPreviewStageDeps;
|
||||
|
||||
/// The columns and mapped/annotated rows for a session whose mapping has
|
||||
/// already been applied. `columns` comes from the session's `parsed_file` —
|
||||
/// the HTML preview template renders it as the table header — while `rows`
|
||||
/// comes from `row_results`. Not in the brief's `PreviewStage::Ready(Vec<AnnotatedRow>)`
|
||||
/// sketch: the deleted `get_preview_page` handler code read both
|
||||
/// `session.parsed_file.columns` and `session.row_results` to render the page,
|
||||
/// so dropping `columns` here would either blank the preview table's header or
|
||||
/// force the handler to re-fetch the session itself (forbidden — that's the
|
||||
/// exact repo call this task removes). See task-2 report for detail.
|
||||
pub struct PreviewRows {
|
||||
pub columns: Vec<String>,
|
||||
pub rows: Vec<AnnotatedRow>,
|
||||
|
||||
@@ -86,8 +86,6 @@ async fn fails_when_session_not_found() {
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
/// A document parser that returns rows with specific field values for testing
|
||||
/// the mark_duplicates logic.
|
||||
struct DuplicateTestParser {
|
||||
rows: Vec<ImportRow>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user