Skip to content

Commit

Permalink
add find one breach query
Browse files Browse the repository at this point in the history
  • Loading branch information
n1nj4t4nuk1 committed Dec 15, 2024
1 parent 1cced85 commit 0143d4d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions libs/cti/src/breaches/application/find_one/find_breach_query.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use std::any::Any;

use cqrs::domain::query::Query;

pub struct FindBreachQuery {
pub cve_id: Option<String>,
pub vendor: Option<String>,
pub product: Option<String>,
pub version: Option<String>,
}

impl FindBreachQuery {
pub const QUERY_TYPE: &'static str = "FindBreachQuery";

pub fn new(cve_id: Option<String>, vendor: Option<String>, product: Option<String>, version: Option<String>) -> FindBreachQuery {
FindBreachQuery { cve_id, vendor, product, version }
}

pub fn new_boxed(cve_id: Option<String>, vendor: Option<String>, product: Option<String>, version: Option<String>) -> Box<dyn Query> {
Box::new(FindBreachQuery::new(cve_id, vendor, product, version))
}
}

impl Query for FindBreachQuery {
fn get_type(&self) -> String {
FindBreachQuery::QUERY_TYPE.to_string()
}

fn as_any(&self) -> &dyn Any {
self
}
}
1 change: 1 addition & 0 deletions libs/cti/src/breaches/application/find_one/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod find_breach_query;

0 comments on commit 0143d4d

Please sign in to comment.