NotificationPreferenceRepository

Trait NotificationPreferenceRepository 

Source
pub trait NotificationPreferenceRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        preference: &'life1 NotificationPreference,
    ) -> Pin<Box<dyn Future<Output = Result<NotificationPreference, String>> + 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<NotificationPreference>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_user_and_type<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
        notification_type: NotificationType,
    ) -> Pin<Box<dyn Future<Output = Result<Option<NotificationPreference>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_user<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<NotificationPreference>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        preference: &'life1 NotificationPreference,
    ) -> Pin<Box<dyn Future<Output = Result<NotificationPreference, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_channel_enabled<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
        notification_type: NotificationType,
        channel: NotificationChannel,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn create_defaults_for_user<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<NotificationPreference>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, preference: &'life1 NotificationPreference, ) -> Pin<Box<dyn Future<Output = Result<NotificationPreference, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new notification preference

Source

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

Find preference by ID

Source

fn find_by_user_and_type<'life0, 'async_trait>( &'life0 self, user_id: Uuid, notification_type: NotificationType, ) -> Pin<Box<dyn Future<Output = Result<Option<NotificationPreference>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find preference by user and notification type

Source

fn find_by_user<'life0, 'async_trait>( &'life0 self, user_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<NotificationPreference>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all preferences for a user

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, preference: &'life1 NotificationPreference, ) -> Pin<Box<dyn Future<Output = Result<NotificationPreference, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update preference

Source

fn delete<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete preference

Source

fn is_channel_enabled<'life0, 'async_trait>( &'life0 self, user_id: Uuid, notification_type: NotificationType, channel: NotificationChannel, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if user has enabled a specific channel for a notification type

Source

fn create_defaults_for_user<'life0, 'async_trait>( &'life0 self, user_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<NotificationPreference>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create default preferences for a new user

Implementors§