Skip to main content

MandateRepository

Trait MandateRepository 

Source
pub trait MandateRepository: Send + Sync {
    // Required methods
    fn save<'life0, 'life1, 'async_trait>(
        &'life0 self,
        mandate: &'life1 Mandate,
    ) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Mandate>, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_active_for_subject<'life0, 'async_trait>(
        &'life0 self,
        subject_user_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Mandate>, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_for_scope<'life0, 'life1, 'async_trait>(
        &'life0 self,
        scope: &'life1 MandateScope,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Mandate>, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn revoke<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
        revoked_at: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, mandate: &'life1 Mandate, ) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist a freshly issued mandate.

Source

fn find_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Mandate>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Look up a mandate by its primary key.

Source

fn list_active_for_subject<'life0, 'async_trait>( &'life0 self, subject_user_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Mandate>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all currently active (non-revoked, within validity window) mandates whose subject is the given user.

Source

fn list_for_scope<'life0, 'life1, 'async_trait>( &'life0 self, scope: &'life1 MandateScope, ) -> Pin<Box<dyn Future<Output = Result<Vec<Mandate>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all mandates that target the given scope (regardless of status). Useful for syndic audit views.

Source

fn revoke<'life0, 'async_trait>( &'life0 self, id: Uuid, revoked_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Atomically revoke a mandate. Implementation MUST do UPDATE ... SET revoked_at = $2 WHERE id = $1 AND revoked_at IS NULL so a double-revoke is a no-op (idempotent).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§