pub trait ConsentRepository: Send + Sync {
// Required methods
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 ConsentRecord,
) -> Pin<Box<dyn Future<Output = Result<ConsentRecord, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn find_latest_by_user_and_type<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
consent_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ConsentRecord>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn find_all_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConsentRecord>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn has_accepted<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
consent_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_consent_status<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<ConsentStatus, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Port (interface) for consent record repository Handles GDPR Art. 7 consent persistence and querying
Required Methods§
Sourcefn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 ConsentRecord,
) -> Pin<Box<dyn Future<Output = Result<ConsentRecord, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 ConsentRecord,
) -> Pin<Box<dyn Future<Output = Result<ConsentRecord, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new consent record (append-only, immutable)
Sourcefn find_latest_by_user_and_type<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
consent_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ConsentRecord>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_latest_by_user_and_type<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
consent_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ConsentRecord>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find the latest consent of a given type for a user
Sourcefn find_all_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConsentRecord>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_all_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConsentRecord>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find all consent records for a user (audit trail)
Sourcefn has_accepted<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
consent_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_accepted<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
consent_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a user has accepted a specific consent type
Sourcefn get_consent_status<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<ConsentStatus, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_consent_status<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<ConsentStatus, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Build a consent status summary for a user