diff --git a/libs/cti/src/cves/application/create_one/cve_creator.rs b/libs/cti/src/cves/application/create_one/cve_creator.rs index 4b62d9d..677c51b 100644 --- a/libs/cti/src/cves/application/create_one/cve_creator.rs +++ b/libs/cti/src/cves/application/create_one/cve_creator.rs @@ -23,16 +23,16 @@ impl CveCreator { date_published: CvePublicationDate, description: CveDescription, ) -> Result<(), DomainError> { - debug!("Starting CVE creation"); + debug!("Starting CVE creation for {}.", id); let key = Cve::new(&id, &state, &date_published, &description); let res = self.repository.create_one(&key).await; if res.is_err() { - debug!("Error creating CVE with id: {}", id.value()); + debug!("Error creating CVE with id: {}.", id); return Err(res.err().unwrap()); } let created_event = CveCreatedEvent::new_shared(&id, &state, &date_published, &description); self.event_bus.publish(created_event).await; - debug!("CVE with id: {} created", id.value()); + debug!("CVE with id: {} created.", id); Ok(()) } } diff --git a/libs/cti/src/cves/domain/entities/cve_id.rs b/libs/cti/src/cves/domain/entities/cve_id.rs index aa06805..d4e5a3c 100644 --- a/libs/cti/src/cves/domain/entities/cve_id.rs +++ b/libs/cti/src/cves/domain/entities/cve_id.rs @@ -1,5 +1,5 @@ use crate::shared::domain::errors::DomainError; -use std::hash::{Hash, Hasher}; +use std::{hash::{Hash, Hasher}, path::Display}; #[derive(Debug)] pub struct CveId { @@ -26,7 +26,7 @@ impl CveId { self.value.clone() } - pub fn ref_value(&self) -> &String { + pub fn rvalue(&self) -> &String { &self.value } } @@ -50,3 +50,9 @@ impl Hash for CveId { self.value.hash(state); } } + +impl std::fmt::Display for CveId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.value) + } +}