UnitOwnerRepository

Trait UnitOwnerRepository 

Source
pub trait UnitOwnerRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        unit_owner: &'life1 UnitOwner,
    ) -> Pin<Box<dyn Future<Output = Result<UnitOwner, 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<UnitOwner>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_current_owners_by_unit<'life0, 'async_trait>(
        &'life0 self,
        unit_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<UnitOwner>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_current_units_by_owner<'life0, 'async_trait>(
        &'life0 self,
        owner_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<UnitOwner>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_all_owners_by_unit<'life0, 'async_trait>(
        &'life0 self,
        unit_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<UnitOwner>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_all_units_by_owner<'life0, 'async_trait>(
        &'life0 self,
        owner_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<UnitOwner>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        unit_owner: &'life1 UnitOwner,
    ) -> Pin<Box<dyn Future<Output = Result<UnitOwner, 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<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn has_active_owners<'life0, 'async_trait>(
        &'life0 self,
        unit_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_total_ownership_percentage<'life0, 'async_trait>(
        &'life0 self,
        unit_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<f64, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_active_by_unit_and_owner<'life0, 'async_trait>(
        &'life0 self,
        unit_id: Uuid,
        owner_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UnitOwner>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_active_by_building<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(Uuid, Uuid, f64)>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

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

Create a new unit-owner relationship

Source

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

Find a unit-owner relationship by ID

Source

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

Get all current owners of a unit (end_date IS NULL)

Source

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

Get all current units of an owner (end_date IS NULL)

Source

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

Get ownership history of a unit (including past owners)

Source

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

Get ownership history of an owner (including past units)

Source

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

Update a unit-owner relationship

Source

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

Delete a unit-owner relationship

Source

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

Check if a unit has any active owners

Source

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

Get the total ownership percentage for a unit (should be <= 1.0)

Source

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

Find active unit-owner relationship by unit and owner IDs

Source

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

Get all active unit-owner relationships for a building Returns tuples of (unit_id, owner_id, ownership_percentage) Useful for calculating charge distributions

Implementors§