koprogo_api/application/ports/
consent_repository.rs1use crate::domain::entities::consent::{ConsentRecord, ConsentStatus};
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
8pub trait ConsentRepository: Send + Sync {
9 async fn create(&self, record: &ConsentRecord) -> Result<ConsentRecord, String>;
11
12 async fn find_latest_by_user_and_type(
14 &self,
15 user_id: Uuid,
16 consent_type: &str,
17 ) -> Result<Option<ConsentRecord>, String>;
18
19 async fn find_all_by_user(&self, user_id: Uuid) -> Result<Vec<ConsentRecord>, String>;
21
22 async fn has_accepted(&self, user_id: Uuid, consent_type: &str) -> Result<bool, String>;
24
25 async fn get_consent_status(&self, user_id: Uuid) -> Result<ConsentStatus, String>;
27}