Expand description
Promotion helpers from quarantined Gingr records into source-agnostic candidates.
Mapping code may read Gingr-shaped DTOs, but the values it returns are domain candidates plus caller-owned source refs. Provider ids stay at this boundary; the domain does not learn Gingr vocabulary.
use std::collections::BTreeMap;
use domain::source;
use gingr::{endpoint, mapping, response};
let provider_record = response::OwnerRecord {
id: endpoint::OwnerId::new(501),
first_name: Some("Sam".to_owned()),
last_name: Some("Rivera".to_owned()),
email: Some(response::provider::Email::new("sam@example.test")),
cell_phone: None,
unknown: BTreeMap::new(),
};
let source_ref = source::RecordRef::new(
source::System::Gingr,
source::record::Id::try_new(provider_record.id.to_string())?,
);
let promoted = mapping::customer::contact_candidate(&provider_record)?;
assert_eq!(source_ref.system(), source::System::Gingr);
assert_eq!(source_ref.record_id().as_str(), "501");
assert_eq!(promoted.provider_owner_id, endpoint::OwnerId::new(501));
assert!(promoted.email.is_some());Modules§
- customer
- Gingr customer mapper boundary that promotes provider payloads into domain candidates.
- pet
- Gingr pet mapper boundary that promotes provider payloads into domain candidates.
- retail
- Gingr retail mapper boundary that promotes provider payloads into domain candidates.
Enums§
- Error
- Errors raised when provider values cannot safely cross this Gingr boundary.
- Provider
Field - Gingr fields required by DTO-to-domain mapping routines.
Type Aliases§
- Result
- Result type returned by fallible mapping operations.