pub struct EnergyCampaignUseCases { /* private fields */ }Implementations§
Source§impl EnergyCampaignUseCases
impl EnergyCampaignUseCases
pub fn new( campaign_repo: Arc<dyn EnergyCampaignRepository>, bill_upload_repo: Arc<dyn EnergyBillUploadRepository>, building_repo: Arc<dyn BuildingRepository>, ) -> Self
Sourcepub async fn create_campaign(
&self,
campaign: EnergyCampaign,
) -> Result<EnergyCampaign, String>
pub async fn create_campaign( &self, campaign: EnergyCampaign, ) -> Result<EnergyCampaign, String>
Create a new energy campaign
Sourcepub async fn get_campaign(
&self,
id: Uuid,
) -> Result<Option<EnergyCampaign>, String>
pub async fn get_campaign( &self, id: Uuid, ) -> Result<Option<EnergyCampaign>, String>
Get campaign by ID
Sourcepub async fn get_campaigns_by_organization(
&self,
organization_id: Uuid,
) -> Result<Vec<EnergyCampaign>, String>
pub async fn get_campaigns_by_organization( &self, organization_id: Uuid, ) -> Result<Vec<EnergyCampaign>, String>
Get all campaigns for an organization
Sourcepub async fn get_campaigns_by_building(
&self,
building_id: Uuid,
) -> Result<Vec<EnergyCampaign>, String>
pub async fn get_campaigns_by_building( &self, building_id: Uuid, ) -> Result<Vec<EnergyCampaign>, String>
Get all campaigns for a building
Sourcepub async fn update_campaign_status(
&self,
id: Uuid,
new_status: CampaignStatus,
) -> Result<EnergyCampaign, String>
pub async fn update_campaign_status( &self, id: Uuid, new_status: CampaignStatus, ) -> Result<EnergyCampaign, String>
Update campaign status
Sourcepub async fn add_offer(
&self,
campaign_id: Uuid,
offer: ProviderOffer,
) -> Result<ProviderOffer, String>
pub async fn add_offer( &self, campaign_id: Uuid, offer: ProviderOffer, ) -> Result<ProviderOffer, String>
Add provider offer to campaign
Sourcepub async fn get_campaign_offers(
&self,
campaign_id: Uuid,
) -> Result<Vec<ProviderOffer>, String>
pub async fn get_campaign_offers( &self, campaign_id: Uuid, ) -> Result<Vec<ProviderOffer>, String>
Get all offers for a campaign
Sourcepub async fn select_offer(
&self,
campaign_id: Uuid,
offer_id: Uuid,
) -> Result<EnergyCampaign, String>
pub async fn select_offer( &self, campaign_id: Uuid, offer_id: Uuid, ) -> Result<EnergyCampaign, String>
Select winning offer
Sourcepub async fn update_campaign_aggregation(
&self,
campaign_id: Uuid,
encryption_key: &[u8; 32],
) -> Result<(), String>
pub async fn update_campaign_aggregation( &self, campaign_id: Uuid, encryption_key: &[u8; 32], ) -> Result<(), String>
Calculate and update campaign aggregations (called after bill uploads)
Sourcepub async fn get_campaign_stats(
&self,
campaign_id: Uuid,
) -> Result<CampaignStats, String>
pub async fn get_campaign_stats( &self, campaign_id: Uuid, ) -> Result<CampaignStats, String>
Get campaign statistics (anonymized)
Sourcepub async fn finalize_campaign(
&self,
id: Uuid,
) -> Result<EnergyCampaign, String>
pub async fn finalize_campaign( &self, id: Uuid, ) -> Result<EnergyCampaign, String>
Finalize campaign (after final vote)
Sourcepub async fn complete_campaign(
&self,
id: Uuid,
) -> Result<EnergyCampaign, String>
pub async fn complete_campaign( &self, id: Uuid, ) -> Result<EnergyCampaign, String>
Complete campaign (contracts signed)
Sourcepub async fn cancel_campaign(&self, id: Uuid) -> Result<EnergyCampaign, String>
pub async fn cancel_campaign(&self, id: Uuid) -> Result<EnergyCampaign, String>
Cancel campaign
Auto Trait Implementations§
impl Freeze for EnergyCampaignUseCases
impl !RefUnwindSafe for EnergyCampaignUseCases
impl Send for EnergyCampaignUseCases
impl Sync for EnergyCampaignUseCases
impl Unpin for EnergyCampaignUseCases
impl !UnwindSafe for EnergyCampaignUseCases
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.