UserAchievementRepository

Trait UserAchievementRepository 

Source
pub trait UserAchievementRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_achievement: &'life1 UserAchievement,
    ) -> Pin<Box<dyn Future<Output = Result<UserAchievement, 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<UserAchievement>, 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<UserAchievement>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_user_and_achievement<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
        achievement_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UserAchievement>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_achievement: &'life1 UserAchievement,
    ) -> Pin<Box<dyn Future<Output = Result<UserAchievement, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn calculate_total_points<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_by_user<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_recent_by_user<'life0, 'async_trait>(
        &'life0 self,
        user_id: Uuid,
        limit: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<UserAchievement>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Repository trait for UserAchievement persistence operations

Required Methods§

Source

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

Award achievement to user

Source

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

Find user achievement by ID

Source

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

Find all achievements earned by a user

Source

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

Find specific user achievement

Source

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

Update user achievement (for repeatable achievements)

Source

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

Calculate total points for user

Source

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

Count achievements earned by user

Source

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

Get recent achievements for user (last N)

Implementors§