Skip to content

Commit

Permalink
add update cve command
Browse files Browse the repository at this point in the history
  • Loading branch information
n1nj4t4nuk1 committed Dec 13, 2024
1 parent cf0d4ba commit d8fb4a9
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/cti/src/cves/application/update_one/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

pub mod cve_updater;
pub mod cve_updater;
pub mod update_cve_command;
65 changes: 65 additions & 0 deletions libs/cti/src/cves/application/update_one/update_cve_command.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
use cqrs::domain::command::Command;

pub struct UpdateCveCommand {
pub id: Option<String>,
pub state: Option<String>,
pub description: Option<String>,
pub assigner_id: Option<String>,
pub assigner_name: Option<String>,
pub date_published: Option<String>,
pub date_updated: Option<String>,
}

impl UpdateCveCommand {
pub const COMMAND_TYPE: &'static str = "[email protected]";

pub fn new(
id: Option<String>,
state: Option<String>,
description: Option<String>,
assigner_id: Option<String>,
assigner_name: Option<String>,
date_published: Option<String>,
date_updated: Option<String>,
) -> UpdateCveCommand {
UpdateCveCommand {
id,
state,
description,
assigner_id,
assigner_name,
date_published,
date_updated,
}
}

pub fn new_boxed(
id: Option<String>,
state: Option<String>,
description: Option<String>,
assigner_id: Option<String>,
assigner_name: Option<String>,
date_published: Option<String>,
date_updated: Option<String>,
) -> Box<dyn Command> {
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
}
}

0 comments on commit d8fb4a9

Please sign in to comment.