diff --git a/libs/cti/src/cves/application/update_one/mod.rs b/libs/cti/src/cves/application/update_one/mod.rs index 8971e93..d36695a 100644 --- a/libs/cti/src/cves/application/update_one/mod.rs +++ b/libs/cti/src/cves/application/update_one/mod.rs @@ -1,2 +1,3 @@ -pub mod cve_updater; \ No newline at end of file +pub mod cve_updater; +pub mod update_cve_command; \ No newline at end of file diff --git a/libs/cti/src/cves/application/update_one/update_cve_command.rs b/libs/cti/src/cves/application/update_one/update_cve_command.rs new file mode 100644 index 0000000..cb2714f --- /dev/null +++ b/libs/cti/src/cves/application/update_one/update_cve_command.rs @@ -0,0 +1,65 @@ +use cqrs::domain::command::Command; + +pub struct UpdateCveCommand { + pub id: Option, + pub state: Option, + pub description: Option, + pub assigner_id: Option, + pub assigner_name: Option, + pub date_published: Option, + pub date_updated: Option, +} + +impl UpdateCveCommand { + pub const COMMAND_TYPE: &'static str = "com.tanukibox.cti.cves.update-one@1.0.0"; + + pub fn new( + id: Option, + state: Option, + description: Option, + assigner_id: Option, + assigner_name: Option, + date_published: Option, + date_updated: Option, + ) -> UpdateCveCommand { + UpdateCveCommand { + id, + state, + description, + assigner_id, + assigner_name, + date_published, + date_updated, + } + } + + pub fn new_boxed( + id: Option, + state: Option, + description: Option, + assigner_id: Option, + assigner_name: Option, + date_published: Option, + date_updated: Option, + ) -> Box { + Box::new(UpdateCveCommand::new( + id, + state, + description, + assigner_id, + assigner_name, + date_published, + date_updated, + )) + } +} + +impl Command for UpdateCveCommand { + fn command_type(&self) -> String { + UpdateCveCommand::COMMAND_TYPE.to_string() + } + + fn as_any(&self) -> &dyn std::any::Any { + self + } +}