pub trait EnergyCampaignRepository: Send + Sync {
// Required methods
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, 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<EnergyCampaign>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_organization<'life0, 'async_trait>(
&'life0 self,
organization_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyCampaign>, 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<EnergyCampaign>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, 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 add_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_offers<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ProviderOffer>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_offer<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_offer_by_id<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ProviderOffer>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_aggregation<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
total_kwh_electricity: Option<f64>,
total_kwh_gas: Option<f64>,
avg_kwh_per_unit: Option<f64>,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Repository trait for energy campaign persistence
Required Methods§
Sourcefn create<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new energy campaign
Sourcefn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<EnergyCampaign>, 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<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find campaign by ID
Sourcefn find_by_organization<'life0, 'async_trait>(
&'life0 self,
organization_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_organization<'life0, 'async_trait>(
&'life0 self,
organization_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find all campaigns for an organization
Sourcefn find_by_building<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyCampaign>, 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<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find all campaigns for a building
Sourcefn update<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update campaign
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 campaign
Sourcefn add_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add provider offer to campaign
Sourcefn get_offers<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ProviderOffer>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_offers<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ProviderOffer>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all offers for a campaign
Sourcefn update_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update provider offer
Sourcefn delete_offer<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_offer<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete provider offer
Sourcefn find_offer_by_id<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ProviderOffer>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_offer_by_id<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ProviderOffer>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get offer by ID
Sourcefn update_aggregation<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
total_kwh_electricity: Option<f64>,
total_kwh_gas: Option<f64>,
avg_kwh_per_unit: Option<f64>,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_aggregation<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
total_kwh_electricity: Option<f64>,
total_kwh_gas: Option<f64>,
avg_kwh_per_unit: Option<f64>,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update campaign aggregated statistics (total_kwh, participants, etc.)