-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf0d4ba
commit d8fb4a9
Showing
2 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
65
libs/cti/src/cves/application/update_one/update_cve_command.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |