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§
Sourcefn 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 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
Sourcefn 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_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
Sourcefn 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_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)
Sourcefn 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_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)
Sourcefn 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_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)
Sourcefn 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 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)
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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)
Sourcefn 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_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
Sourcefn 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,
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