OwnerCreditBalanceRepository

Trait OwnerCreditBalanceRepository 

Source
pub trait OwnerCreditBalanceRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        balance: &'life1 OwnerCreditBalance,
    ) -> Pin<Box<dyn Future<Output = Result<OwnerCreditBalance, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_owner_and_building<'life0, 'async_trait>(
        &'life0 self,
        owner_id: Uuid,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<OwnerCreditBalance>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_building<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OwnerCreditBalance>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_owner<'life0, 'async_trait>(
        &'life0 self,
        owner_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OwnerCreditBalance>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_or_create<'life0, 'async_trait>(
        &'life0 self,
        owner_id: Uuid,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<OwnerCreditBalance, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        balance: &'life1 OwnerCreditBalance,
    ) -> Pin<Box<dyn Future<Output = Result<OwnerCreditBalance, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        owner_id: Uuid,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_leaderboard<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
        limit: i32,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OwnerCreditBalance>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_active_participants<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_total_credits_in_circulation<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Repository trait for OwnerCreditBalance entity (SEL credit tracking)

Required Methods§

Source

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

Create a new credit balance (starts at 0)

Source

fn find_by_owner_and_building<'life0, 'async_trait>( &'life0 self, owner_id: Uuid, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<OwnerCreditBalance>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find a credit balance by owner and building

Source

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

Find all balances for a building

Source

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

Find all balances for an owner (across all buildings)

Source

fn get_or_create<'life0, 'async_trait>( &'life0 self, owner_id: Uuid, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<OwnerCreditBalance, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get or create a balance (ensures balance exists)

Source

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

Update a credit balance

Source

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

Delete a credit balance

Source

fn get_leaderboard<'life0, 'async_trait>( &'life0 self, building_id: Uuid, limit: i32, ) -> Pin<Box<dyn Future<Output = Result<Vec<OwnerCreditBalance>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get leaderboard (top contributors by balance)

Source

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

Get active participants count (owners with at least 1 exchange)

Source

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

Get total credits in circulation for a building

Implementors§