From b362b4cc87e68433f385a46f48abbb1ff6be97d9 Mon Sep 17 00:00:00 2001 From: Javier Parada Date: Tue, 3 Dec 2024 10:11:59 +0100 Subject: [PATCH] add cve repo --- libs/cti/src/cves/domain/mod.rs | 3 ++- .../cti/src/cves/domain/repositories/cve_repository.rs | 10 ++++++++++ libs/cti/src/cves/domain/repositories/mod.rs | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 libs/cti/src/cves/domain/repositories/cve_repository.rs create mode 100644 libs/cti/src/cves/domain/repositories/mod.rs diff --git a/libs/cti/src/cves/domain/mod.rs b/libs/cti/src/cves/domain/mod.rs index 0f5b973..55eaa17 100644 --- a/libs/cti/src/cves/domain/mod.rs +++ b/libs/cti/src/cves/domain/mod.rs @@ -1,2 +1,3 @@ pub mod entities; -pub mod events; \ No newline at end of file +pub mod events; +pub mod repositories; \ No newline at end of file diff --git a/libs/cti/src/cves/domain/repositories/cve_repository.rs b/libs/cti/src/cves/domain/repositories/cve_repository.rs new file mode 100644 index 0000000..742f9b1 --- /dev/null +++ b/libs/cti/src/cves/domain/repositories/cve_repository.rs @@ -0,0 +1,10 @@ +use crate::{cves::domain::entities::{cve::Cve, cve_id::CveId}, shared::domain::errors::DomainError}; +use async_trait::async_trait; + +#[async_trait] +pub trait CveRepository: Send + Sync + 'static { + async fn find_by_id(&self, id: &CveId) -> Result; + async fn create_one(&self, user: &Cve) -> Result<(), DomainError>; + async fn update_one(&self, user: &Cve) -> Result<(), DomainError>; + async fn delete_one(&self, id: &CveId) -> Result<(), DomainError>; +} diff --git a/libs/cti/src/cves/domain/repositories/mod.rs b/libs/cti/src/cves/domain/repositories/mod.rs new file mode 100644 index 0000000..48eb78d --- /dev/null +++ b/libs/cti/src/cves/domain/repositories/mod.rs @@ -0,0 +1 @@ +pub mod cve_repository; \ No newline at end of file