ChargeDistributionRepository

Trait ChargeDistributionRepository 

Source
pub trait ChargeDistributionRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        distribution: &'life1 ChargeDistribution,
    ) -> Pin<Box<dyn Future<Output = Result<ChargeDistribution, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_bulk<'life0, 'life1, 'async_trait>(
        &'life0 self,
        distributions: &'life1 [ChargeDistribution],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ChargeDistribution>, 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<ChargeDistribution>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_expense<'life0, 'async_trait>(
        &'life0 self,
        expense_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ChargeDistribution>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_unit<'life0, 'async_trait>(
        &'life0 self,
        unit_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ChargeDistribution>, 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<ChargeDistribution>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_by_expense<'life0, 'async_trait>(
        &'life0 self,
        expense_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_total_due_by_owner<'life0, 'async_trait>(
        &'life0 self,
        owner_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<f64, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

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

Create a single charge distribution

Source

fn create_bulk<'life0, 'life1, 'async_trait>( &'life0 self, distributions: &'life1 [ChargeDistribution], ) -> Pin<Box<dyn Future<Output = Result<Vec<ChargeDistribution>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create multiple charge distributions in bulk (for performance)

Source

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

Find charge distribution by ID

Source

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

Find all charge distributions for an expense/invoice

Source

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

Find all charge distributions for a unit

Source

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

Find all charge distributions for an owner

Source

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

Delete all distributions for an expense (e.g., if invoice is cancelled)

Source

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

Get total amount due for an owner across all pending distributions

Implementors§