EnergyBillUploadRepository

Trait EnergyBillUploadRepository 

Source
pub trait EnergyBillUploadRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        upload: &'life1 EnergyBillUpload,
    ) -> Pin<Box<dyn Future<Output = Result<EnergyBillUpload, 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<EnergyBillUpload>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_campaign<'life0, 'async_trait>(
        &'life0 self,
        campaign_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyBillUpload>, 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<EnergyBillUpload>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_campaign_and_unit<'life0, 'async_trait>(
        &'life0 self,
        campaign_id: Uuid,
        unit_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<EnergyBillUpload>, 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<EnergyBillUpload>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        upload: &'life1 EnergyBillUpload,
    ) -> Pin<Box<dyn Future<Output = Result<EnergyBillUpload, 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 find_expired<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyBillUpload>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_verified_by_campaign<'life0, 'async_trait>(
        &'life0 self,
        campaign_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_verified_by_campaign<'life0, 'async_trait>(
        &'life0 self,
        campaign_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyBillUpload>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_expired<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Repository trait for energy bill upload persistence

Required Methods§

Source

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

Create a new energy bill upload

Source

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

Find bill upload by ID

Source

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

Find all uploads for a campaign

Source

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

Find all uploads for a unit

Source

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

Find upload for a specific campaign and unit

Source

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

Find uploads by building

Source

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

Update bill upload

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 bill upload (soft delete)

Source

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

Find uploads that need auto-deletion (retention period expired)

Source

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

Get count of verified uploads for a campaign (for k-anonymity check)

Source

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

Find all verified, non-deleted uploads for a campaign (for aggregation)

Source

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

Batch delete expired bills (GDPR auto-cleanup)

Implementors§